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?
document.frames["myInnerFrame"].location.href=fl;
http://www.hotscripts.com/forums/javascript/15955-javascript-command-refresh-iframe-content.html
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.
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...
来源:https://stackoverflow.com/questions/3991226/refresh-iframe-without-refreshing-the-parent-page