m pulling this image from here: https://api.sat24.com/animated/EU/visual/2/GTB%20Standard%20Time/ and im using html plugin, its work but wont refresh image one is loaded, i need to refresh hole grafana page and then will update the image.
Little help how i can make it to work without refreshing hole grafana page?
My URL loads perfectly via the Text panel in Grafana when I have just
but like the original poster here, my image (which is a still image from a video camera) does not refresh. Here is what I added:
and here is what I see:
Hm I think you have at least two issues:
- Your script isn’t being picked up as such. I guess you haven’t disabled the HTML sanitize option: Configuration | Grafana Labs. I would also recommend using lowercase HTML tags (e.g.
<script>), though I don’t think that’s the issue here
Thank you. Re: the second point, I will try something like this:
<!DOCTYPE html> <html> <head> <title>Refresh Image</title> </head> <body> <!-- Display the image --> <img id="gfgimage" src="bg.png" height="500" width="700" /> <script> // Create a timestamp var timestamp = new Date().getTime(); // Get the image element var image = document.getElementById("gfgimage"); // Adding the timestamp parameter to image src image.src = "bg.png?t=" + timestamp; console.log(image.src); </script> </body> </html>
Back again…Disabling the HTML sanitize made it better in that I no longer see the script text on the screen. But even after trying various coding ways to get the image URL to refresh (incl. using an ID), I still cannot get it to automatically refresh.
I haven’t tried JS in 8.1 but would be surprised if it has suddenly been disabled altogether (with the correct settings option).
<body> tags - those already exist in the webpage. Only the stuff inside
<body> is what you should provide.
I can try to share a working example when I’m back in front of my computer, but it’ll be a few days (am currently on holiday)
Thanks for helping me during your holiday! Here is one that I found online that people said worked and which I could generally understand…
Here is another attempt…
Hi @grant2 I’m afraid it looks like you’re stabbing in the dark here. A couple of points regarding the last few versions you shared:
- As I mentioned, your HTML should not include
<body>tags; the Grafana web page already has a body and you can’t nest another one inside it.
- You should give the image an
name), and then use that
document.getElementById(id). I don’t think that
document.iddoes anything useful.
- You should make sure that the function you define actually gets called.
I haven’t tested it myself, but I feel like something like the below might work:
Thank you Svet! It works flawlessly. I have been working on getting this to work in some form or another for months…tried every plug in and now it’s finally working! I owe you a beer or coffee!
Ah, great to hear it’s working! Happy to help
Thank you for posting this! It doesn’t seem to work for me though as the image does not refresh. Here’s the code I am using. I have disable_sanitize_html set to true. Any ideas?
console.log("Refreshing")) to the function, to check that it’s actually being run (again, by looking for that message in the browser log).
Thanks! I added the message to the code and the “Refreshing” message showed in the console and yeah! the image now refreshes. I doubt that adding a message fixed it – I also decided to stop the docker, rebuild it and restart it so that is probably what fixed it. Thank you again for the solution!
This topic was automatically closed after 365 days. New replies are no longer allowed.