Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

SVG Image randomly fails to load upon being changed/set (Javascript/HTML)

  • பதில்கள் இல்லை
  • 2 இந்த பிரச்னைகள் உள்ளது
  • 1 view

I have this website: http://cluck.life/

It loads an SVG image that changes each minute. I have been experiencing an issue which occurs in during the condition that this web page is open in a tab, but another tab is selected at the time. Then, when the page's timer detects that the image needs to change it swaps the SVG. But during the described condition where a different tab is selected, and one returns to the tab of the web page, the SVG will not be loaded.

To solve this, I have attempted to make it call the function that sets the SVG when the page regains focus. This has not solved the problem, only heavily decreased the chance of it.

What I have experienced since then is that since the SVG will reload every time the window regains focus, if I continually hide and unhide the window, therefore causing it to reload the SVG, eventually the SVG will simply not load and be invisible. I can hide and unide the window again and it will likely reload. For each time it is reloaded there is a small chance it will simply not show. I have been experiencing this even when not attempting to reproduce it.

This can also be done in a timely manner by clicking the SVG, then clicking the background to the side. This will also cause it to refresh and is a much faster method.

Notes: (1. I am refreshing it continually simply to cause the issue I have been experiencing regardless to occur. If I do not do this it will happen eventually anyways, be it when the SVG is changed each minute, or when the tab is switched to.

(2. It is possible that the code for my website is at fault. I acknowledge this possibility. Though I have not been able to reproduce the same issue on Google Chrome, which leads me to believe this is Firefox related.

(3. I have been debugging the issue in attempt to see if it is associated with my code or any specific scenario which causes it to fail. Stepping through the code the instant the SVG disappears is when the variable is set to a new SVG which works normally.

Video reproducing issue: https://www.dropbox.com/s/l0x7560fc5th2rg/FirefoxSVGBug.mp4?raw=1

Code Associated with this website: https://github.com/Daniel-McCarthy/Daniel-McCarthy.github.io/blob/master/index.html https://github.com/Daniel-McCarthy/Daniel-McCarthy.github.io/blob/master/script.js

Thank you for any possible assistance

I have this website: http://cluck.life/ It loads an SVG image that changes each minute. I have been experiencing an issue which occurs in during the condition that this web page is open in a tab, but another tab is selected at the time. Then, when the page's timer detects that the image needs to change it swaps the SVG. But during the described condition where a different tab is selected, and one returns to the tab of the web page, the SVG will not be loaded. To solve this, I have attempted to make it call the function that sets the SVG when the page regains focus. This has not solved the problem, only heavily decreased the chance of it. What I have experienced since then is that since the SVG will reload every time the window regains focus, if I continually hide and unhide the window, therefore causing it to reload the SVG, eventually the SVG will simply not load and be invisible. I can hide and unide the window again and it will likely reload. For each time it is reloaded there is a small chance it will simply not show. I have been experiencing this even when not attempting to reproduce it. This can also be done in a timely manner by clicking the SVG, then clicking the background to the side. This will also cause it to refresh and is a much faster method. Notes: (1. I am refreshing it continually simply to cause the issue I have been experiencing regardless to occur. If I do not do this it will happen eventually anyways, be it when the SVG is changed each minute, or when the tab is switched to. (2. It is possible that the code for my website is at fault. I acknowledge this possibility. Though I have not been able to reproduce the same issue on Google Chrome, which leads me to believe this is Firefox related. (3. I have been debugging the issue in attempt to see if it is associated with my code or any specific scenario which causes it to fail. Stepping through the code the instant the SVG disappears is when the variable is set to a new SVG which works normally. Video reproducing issue: https://www.dropbox.com/s/l0x7560fc5th2rg/FirefoxSVGBug.mp4?raw=1 Code Associated with this website: https://github.com/Daniel-McCarthy/Daniel-McCarthy.github.io/blob/master/index.html https://github.com/Daniel-McCarthy/Daniel-McCarthy.github.io/blob/master/script.js Thank you for any possible assistance

ellokitty மூலமாக திருத்தப்பட்டது