刷新iframe而不刷新父页面

问题描述 投票:2回答:3

我有一个不断刷新的页面,我想将页面包含在我的主页面中。

我正在使用iframe将页面包含在我的主页面中,但每次iframe中的页面刷新时,它都会刷新我的主页面。如何在自己的框架内进行iframe刷新而不影响我的主页面?

或者有没有更好的方法来包含页面而不使用iframe?

iframe refresh
3个回答

0
投票

如果您需要从页面后面的asp.net代码刷新父页面,您只需注册客户端脚本即可在页面加载时运行:

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);          
    } 

关于How to refresh parent page on child window close的逐步教程说明了上述函数的使用。


0
投票

我有一个解决方案:

HERE

这实际上每3秒重新加载一次iframe,但它可以很容易地根据您的需要进行一次性重新加载,因为基本原理适用...

© www.soinside.com 2019 - 2024. All rights reserved.