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 [Paessler Support] (9,613) 3 3

Last change on Oct 14, 2010 1:53:41 PM by  Daniel Zobel [Paessler Support] (21,383) 3 3



8 Replies

Accepted Answer

Votes:

1

Your Vote:

Up

Down

The PRTG API can help you with this (requires PRTG 8).

Find the file "customerscripts.js" in the folder

PRTG Network Monitor\website\javascript

and open it with a text editor.

Paste the following code into the file:

$(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.

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>

Note: If you use a PRTG version newer than V8.4.x please apply the following patch to the file "prtg.js":

$(function() {
    $("#showamap").delegate("a", "click", function(e) {
        e.preventDefault();
    });
});

Created on Oct 14, 2010 1:51:04 PM by  Dirk Paessler [Paessler Support] (9,613) 3 3

Last change on Jul 6, 2011 9:28:17 PM by  Dirk Paessler [Paessler Support] (9,613) 3 3



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 (64) 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] (15,450) 3 1



Votes:

0

Your Vote:

Up

Down

Good news!

Created on Oct 19, 2010 1:21:32 PM by  Gennady (64) 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 [Paessler Support] (9,613) 3 3



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  MattG (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 [Paessler Support] (9,613) 3 3



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.

PRTG
Network Monitor
Intuitive to Use.
Easy to manage.

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

Visit
www.paessler.com

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