Reputation: 41
How can I force an iframe to reload and not load from cache?
Upvotes: 4
Views: 2020
Reputation: 449385
To force it to reload every time, add a random GET parameter to its URL:
iframe.src = "testpage.html?reload="+Math.random();#
or as Jacob suggests, the current timestamp (eliminating the possibility of duplicates):
iframe.src = "testpage.html?reload="+(new Date()).getTime();
Upvotes: 4
Reputation: 4211
someIframe.src += "#forceReload";
Should work. or:
someIframe.src += "?fakeQuery";
Upvotes: 0