The most reliable way to “reset” a GIF is by appending a random query string. However this does mean that the GIF will be redownloaded every time so make sure it’s a small file.
// reset a gif:
img.src = img.src.replace(/\?.*$/,"")+"?x="+Math.random();
More Related Contents:
- Export html table data to Excel using JavaScript / JQuery is not working properly in chrome browser
- Jquery load() only working in firefox?
- JSFiddle code not working in my own page
- Prevent contenteditable adding on ENTER – Chrome
- Chrome Extension how to send data from content script to popup.html
- How can I remove the “No file chosen” tooltip from a file input in Chrome?
- How can I retain the scroll position of a scrollable area when pressing back button?
- Animated gif only loops once in Chrome and Firefox
- Anchor tag download attribute not working :Bug in Chrome 35.0.1916.114
- jQuery in Chrome returns “block” instead of “inline”
- Chrome Extension “Refused to load the script because it violates the following Content Security Policy directive”
- Print repeating Page headers in Chrome [closed]
- Get the longest text in HTML document using Jquery or javascript
- Hide/Show image on one click [closed]
- jQuery Mobile: document ready vs. page events
- How to move an element into another element?
- How to prevent a click on a ‘#’ link from jumping to top of page?
- jQuery: Get selected element tag name
- Attach an event in a child iframe to a handler in the parent window
- HTML anchor link – href and onclick both?
- document.getElementsByClassName().innerHTML always returns “undefined”
- jQuery jump or scroll to certain position, div or target on the page from button onclick [duplicate]
- JavaScript: Invert color on all elements of a page
- Failed to load resource: net::ERR_CONTENT_LENGTH_MISMATCH
- jQuery support “:invalid” selector
- jQuery: How to listen for DOM changes?
- submit event does not fire if submit initiated programmatically
- How can I remove wrapper (parent element) without removing the child?
- copying the value of a form’s file input field to another form’s input field
- Bootstrap Dropdown menu is not working