'Refresh iframe without refreshing the parent page
I have a page that constantly refreshes itself, I want to include the page into my main page.
I am using an iframe to include the page to my main page, but every time the page in the iframe refreshes, it also refreshes my main page. How can I make the iframe refresh within its own frame and not affect my main page?
Or is there a better way to include the page without using iframes?
Solution 1:[1]
document.frames["myInnerFrame"].location.href=fl;
http://www.hotscripts.com/forums/javascript/15955-javascript-command-refresh-iframe-content.html
Solution 2:[2]
If you need to refresh the parent page from asp.net code behind page, you can just register client script to run on page load:
protected void btnOk_Click(object sender, EventArgs e)
{
//Implement Your logic here.....
//..............................
//now refresh parent page and close this window
string script = "this.window.opener.location=this.window.opener.location;this.window.close();";
if (!ClientScript.IsClientScriptBlockRegistered("REFRESH_PARENT"))
ClientScript.RegisterClientScriptBlock(typeof(string), "REFRESH_PARENT", script, true);
}
The stepwise tutorial on How to refresh parent page on child window close illustrates the use of the above function.
Solution 3:[3]
I have a solution:
This actually reloads an iframe every 3 seconds, but it can be easily tailored to your needs for a 1-time reload since the basic principals apply...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | zod |
| Solution 2 | sangam |
| Solution 3 | Astad |
