How to reload an iframe from within its source

Hi,

Today I had a requirement where it was desired that on click of a button an iframe should get re-loaded and that button was within the source of that iframe.

I tried everything else on google, but nothing worked.

Finally I found this and it worked

self.location.reload();

Here is the complete code…

abc.html
=========





http://def.html




def.html
=========




http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js

$(document).ready(function()
{
var d = new Date();
// set the HTML content of the element with id=time
$("#time").html(d.getTime());

// define what happens on click of the element with id="download"
$("#download").click(function()
{
// Simply re-load myself 🙂
self.location.reload();
});

});







Download


0 Replies to “How to reload an iframe from within its source”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.