Hi,
I've been playing around a little with the Custom HTML Element in the Maps designer. When i selct a sensor on the left pane and then drag the element onto the map it works well. When I enter simple html like <a href="some.link.com">link</a>
into the HTML Before field it works perfectly well.
If I do the same with some more complex code like
<script type='text/javascript'> <!-- if(typeof my_custom_id == 'undefined') { var my_custom_id = 1; } else { my_custom_id++; } document.writeln('<a id=\'my_custom_id_'+my_custom_id+'\'/>'); var sensor_id = document.getElementById('my_custom_id_'+my_custom_id).parentElement.getAttribute('objectid'); document.write('<a href=\'http://servername/api/getsensordetails.xml?id='+sensor_id+'&username=prtgadmin&passhash=XXXXXXXXXXXXX\'>XML Live data for Sensor #'+sensor_id+'</a>'); --> </script>
it fails. Once I hit the Save-Button, it seems to open a new window in which it tries to execute the code without the context of the map code.
If I take the HTML code of a map and copy it into a new file and then manually add my custom code to the right spot it seems to work. Any idea how I can overcome this and use the HTML Before field to enter the custom code from above? Using PRTG 12.
Thanks for your help in advance.
Kind regards
Add comment