We need to disable the Hyperlinks in the maps (the 2nd Map option where publicly accessible link is allowed) so that the end-users do not have the ability to click on a sensor.
How can I do this?
We need to disable the Hyperlinks in the maps (the 2nd Map option where publicly accessible link is allowed) so that the end-users do not have the ability to click on a sensor.
How can I do this?
Created on Oct 14, 2010 1:45:41 PM by
Dirk Paessler [Founder Paessler AG]
(11,025)
●3
●6
Last change on Oct 14, 2010 1:53:41 PM by
Daniel Zobel [Product Manager]
17 Replies
Update: As of PRTG version 16.3.26, you can create public maps with disabled links by using the maps settings.
For details please see PRTG Manual: Maps Settings—Settings: Public Access.
This article applies to PRTG Network Monitor 12 through 16.3.25
Important note: As of PRTG version 16.3.26, you can use the settings of a public map to disable its links. Please see above. |
The PRTG API can help you with this (requires PRTG 8).
Find the file scripts_custom.js in the \webroot\javascript subfolder of your PRTG installation and open it with a text editor. (Note: In versions previous to PRTG 13.2.3, the target file is customerscripts.js in \website\javascript.)
Paste the following code into the file:
$(document).ready(function() { if ($("body.publicmapshow").length>0) // check: is this a mapshow page { $("a").attr("href", "#").attr("onclick", "return false;");; // disable all links on page, they still look like links //OR //$("a").each(function(){$(this).replaceWith($(this).text())}); //replaces all links with just their text } });
$(document).ready(function() { if ($("#maprefreshlink").length>0) // check: is this a mapshow page { $("a").attr("href", "#"); // disable all links on page, they still look like links // OR // $("a").each(function(){$(this).replaceWith($(this).text())}); //replaces all links with just their text } });
The code is run everytime a PRTG page is loaded. It checks if the page is displaying a map and then iterates through all <a> tags and overwrites their HREF properties with a "#" to invalidate the links.
If you use a PRTG version newer than V8.4.x, please apply the following patch to the file prtg.js:
$(function() { $(".sensorgraph").attr("onclick", ""); $("#showamap").delegate("a", "click", function(e) { e.preventDefault(); }); });
If you use a PRTG version 13.4.x.x or newer, please apply the following patch to the file scripts_custom.js:
$(function(){ $("body.publicmapshow").on('click','a',function(){return false;}); });
Note: If you use a PRTG version previous to V8.1.0.1678 you must either update or apply the following patch to the file "prtg.js":
Remove this line (2nd last line of the file)
<#comment Include customer's own Javascript>
Created on Oct 14, 2010 1:51:04 PM by
Dirk Paessler [Founder Paessler AG]
(11,025)
●3
●6
Last change on Sep 19, 2016 3:49:36 PM by
Gerald Schoch [Paessler Support]
Sorry, but how can I use PRTG V8.1.0.1678 if newest availiable version now to download now is 8.1.0.1676?!
A newer version will be available today.
Good news!
Hello,
I tried the above solution but the links are still visible. Any ideas? Is it to do with AJAX?
PRTG Network Monitor 8.1.2.1810 Operating System: Windows XP (5.1.1 Build 2600 Service Pack 3), 4 CPUs, Intel Pentium, on "STM3500418AS"
Thanks
Nicholas
@nicholasrichardson: The following code may help
$("a").each(function(){$(this).replaceWith($(this).text())}); replaces all links with just their text
I have pasted this into the "best answer" above, too.
Is it possible to choose which maps are affected?
@MattG: You could edit the script to look into the URL parameters. Each map as a unique "id=" url parameter and trigger your code by that
The if statement in my code shown above would change similar to this:
if (($("#maprefreshlink").length>0) && (getURLParam("id")="123"))
For the latest version 12 add this to the customerscripts.js
$(function() { $(".sensorgraph").attr("onclick", ""); $(".map_linkedobject").attr("onclick", "return false;"); $("#showamap").delegate("a", "click", function(e) { e.preventDefault(); }); });
Is there a way to edit that javascript to exclude certain links ? I have a setup with links to other maps. Can I add a "whitelist" section to it ?
Sorry, it's only possible to exclude all links.
I agree that Read Only maps (with no links) would be useful. I think that only being able to restrict links in all maps is a poor solution.
How about in a next version adding a parameter to the public map link that tells the map whether it is to display read only. eg. &ro=true I'm sure you would make a much better job adding the code into the product properly rather that having users fiddle about in the javascript trying to disable links with 'self modifying' code.
I also agree that "true read only" maps would be a very welcome addition. Because I want to publish a few dashboards for "public" use but do not want any way to access PRTG itself from them or even expose the possibility.
Also I cannot get the mentioned solutions to work. I am using PRTG 16.3.24.4980 and have tried these solutions in \webroot\javascript\scripts_custom.js - all links are still available and clickable in public maps. Has this changed again with later versions?
Christian, the above listed scripts were outdated. Please try the following one:
$(document).ready(function() { if ($("body.publicmapshow").length>0) // check: is this a mapshow page { $("a").attr("href", "#").attr("onclick", "return false;");; // disable all links on page, they still look like links //OR //$("a").each(function(){$(this).replaceWith($(this).text())}); //replaces all links with just their text } });
(as of PRTG version 16.2.24/16.3.24)
As an update to this thread, we'll introduce a setting to this with version 16.3.26, where you can set this on each map individually.
Is there a way to disable the link for one object in the map, only for that object. Or is there a way to change the object to disable the links?
Hi there,
Unfortunately, you can only disable the links for the complete map, not just one object.
Best regards.
Please log in or register to enter your reply.
©2023 Paessler AG Terms & Conditions Privacy Policy Legal Notice Download & Install
Add comment