here's is one way you can do this however my way does not use IFrames, but it does pull all the html from another page.
your html <div id="target"> </div> your script $.ajax({ url:"source.html", caching:false, success: function(html) { $("#target").html(html); } }); so what i do is i loop it in a setTimout function refreshData() { setTimeout(function() { $("#target").html(""); // clear html // refill html $.ajax({ url:"source.html", caching:false, success: function(html) { $("#target").html(html); } }); refreshData(); // recall this functon every 5 seconds. }, 5000); } On Sat, Jun 6, 2009 at 3:11 AM, Amit Saurav <amitsau...@gmail.com> wrote: > > Hello, > > I am using a jQuery script to insert iframe in the document after the > page load completes as follows: > > jQuery(window).load(function() { > var container = jQuery(‘#container_id”); > jQuery(‘<iframe id=”my_iframe” > src=”www.some-url.com”></iframe>’).prependTo(container); > }); > > Apparently there is a problem (or probably a speed-up trick) with > Firefox where it tries to cache any iframe content so that next time > when you come back to the page (using forward or back button), it > fetches the content of the iframe from its cache rather than making a > new request. This is a problem to my usecase as the number of request > received by the server is of high importance. > > Hence to get around this caching issue I have a small piece of > cache-busting code just after prependTo() call above, which forces a > reload of the iframe is as follows: > > if ((navigator.userAgent.indexOf("Firefox") > -1) && > (navigator.userAgent.indexOf("Windows") > -1)) { > var i = document.getElementById("my_iframe"); > if (i) { > i.src="www.some-url.com"; > } > } > > I read somewhere that when we add iframes to the DOM dynamically, it > actually takes some amount of time before which it can be queried > using the standard DOM manipulation function. So, I am suspecting that > for most of the time my cache-busting code above does not do anything, > but it’s hard to spot the error as it could be happening only 1 in 10 > times or less. > > My question is, would using jQuery’s selector to get the iframe node > for cache-busting help me get around this iframe-ready-to-query delay? > I just want to ensure that my cache-busting code runs every time its > meant to run. > > I appreciate any help. > > Thanks, >