Refresh iframe without refreshing the parent page

血红的双手。 提交于 2019-12-08 02:03:32

问题


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?


回答1:


document.frames["myInnerFrame"].location.href=fl; 

http://www.hotscripts.com/forums/javascript/15955-javascript-command-refresh-iframe-content.html

http://forums.asp.net/t/1309969.aspx




回答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.




回答3:


I have a solution:

HERE

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!