This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

Force iframe Refresh

Im using an iframe with some custom javascript to change the source url. I have 1 page set up with page link buttons that all point to the 1 iframe page on the LM, each button has a different additional class that changes the source url. This work fine when hopping between different LM's and websites. But im having trouble accessing different pages on the same LM. I believe the browser is caching the page, when i select a button that changes the url to it seems the browser is disregarding the /#pagenumber and returns the last cached page of the LM (

if i move to a different page on the LM and then back to the new URL its fine, it seems to happen only when the iframe has loaded the source and then next url is the same only the /#is different.

Currently my work around is to make separate dedicated iframe pages where this scenario occurs, so an iframe page with a static url, and another with a static url etc etc

Is there another way to get around this? maybe forcing the iframe to refresh or stop the browser form caching?
Try changing iframe src twice: first set it to about:blank, then set it to the required URL.
Did you try to set the refresh interval?
Hi, Just bringing this up again as i have run into the same problem on another project and would like to avoid creating additional pages/ iframes as i did last time if possible.

I tried setting the URL to blank before changing but i didnt have any luck, i also tried setting the refresh interval but this seemed to refresh to the URL hard set in the iframe property window and not the url from the javascript.

Any other ideas?
A short delay works for me, try this:
$(function() {
  function setframe(url) {
    var frame = $('.frame iframe').attr('src', 'about:blank');
    setTimeout(function() {
      frame.attr('src', url);
    }, 10);
  $('.btn-1').off('vclick').on('vclick', function() {
  $('.btn-2').off('vclick').on('vclick', function() {
Thanks, that’s got it working now!

Forum Jump: