New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

300.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


How to disable links in public maps?

Votes:

0

Your Vote:

Up

Down

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?

api javascript maps prtg

Created on Oct 14, 2010 1:45:41 PM by  Dirk Paessler [Founder Paessler AG] (10,921) 3 4

Last change on Oct 14, 2010 1:53:41 PM by  Daniel Zobel [Product Manager]



17 Replies

Accepted Answer

Votes:

1

Your Vote:

Up

Down

Update: As of PRTG version 16.3.26, you can create public maps with disabled links by using the maps settings.

  • In the PRTG web interface, open the Settings tab of the desired map.
  • Navigate to section Public Access.
  • Choose the option Allow public access, disable all links (map can be viewed by using a unique URL).
  • Save the settings and the map will be a non-interactive public map.

For details please see PRTG Manual: Maps Settings—Settings: Public Access.


This article applies to PRTG Network Monitor 12 through 16.3.25

Disabling Links in Public Maps

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
  }
});

For previous PRTG versions (Deprecated)

$(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] (10,921) 3 4

Last change on Sep 19, 2016 3:49:36 PM by  Gerald Schoch [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Sorry, but how can I use PRTG V8.1.0.1678 if newest availiable version now to download now is 8.1.0.1676?!

Created on Oct 19, 2010 6:54:41 AM by  Gennady (60) 2 1



Votes:

0

Your Vote:

Up

Down

A newer version will be available today.

Created on Oct 19, 2010 9:18:29 AM by  Torsten Lindner [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Good news!

Created on Oct 19, 2010 1:21:32 PM by  Gennady (60) 2 1



Votes:

0

Your Vote:

Up

Down

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

Created on Jul 5, 2011 2:47:02 PM by  nicholasrichardson (0)



Votes:

0

Your Vote:

Up

Down

@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.

Created on Jul 6, 2011 9:33:28 PM by  Dirk Paessler [Founder Paessler AG] (10,921) 3 4



Votes:

0

Your Vote:

Up

Down

Is it possible to choose which maps are affected?

Created on Sep 26, 2011 3:09:10 AM by  MorganL (0) 1



Votes:

0

Your Vote:

Up

Down

@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"))

Created on Sep 26, 2011 1:30:48 PM by  Dirk Paessler [Founder Paessler AG] (10,921) 3 4



Votes:

0

Your Vote:

Up

Down

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(); }); });

Created on Oct 12, 2012 9:36:56 AM by  Aurelio Lombardi [Paessler Support]



Votes:

0

Your Vote:

Up

Down

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 ?

Created on Mar 11, 2014 4:19:32 PM by  nrgcc (0) 1



Votes:

0

Your Vote:

Up

Down

Sorry, it's only possible to exclude all links.

Created on Mar 12, 2014 12:37:07 PM by  Torsten Lindner [Paessler Support]



Votes:

0

Your Vote:

Up

Down

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.

Created on Mar 18, 2014 7:22:37 PM by  cabc (0) 1



Votes:

0

Your Vote:

Up

Down

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?

Created on Aug 19, 2016 7:58:28 AM by  Christian Möller (1) 1



Votes:

0

Your Vote:

Up

Down

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)

Created on Aug 19, 2016 11:20:56 AM by  Torsten Lindner [Paessler Support]



Votes:

0

Your Vote:

Up

Down

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.

Created on Sep 5, 2016 2:30:58 PM by  Torsten Lindner [Paessler Support]



Votes:

0

Your Vote:

Up

Down

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?

Created on Mar 23, 2017 2:03:23 PM by  viulate (0)



Votes:

0

Your Vote:

Up

Down

Hi there,

Unfortunately, you can only disable the links for the complete map, not just one object.

Best regards.

Created on Mar 23, 2017 3:52:18 PM by  Dariusz Gorka [Paessler Support]



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.