【问题标题】:Refresh iframe without refreshing the parent page刷新 iframe 而不刷新父页面
【发布时间】:2011-04-28 19:41:00
【问题描述】:

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

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

或者有没有更好的方法在不使用 iframe 的情况下包含页面?

【问题讨论】:

    标签: iframe refresh


    【解决方案1】:
    【解决方案2】:

    如果您需要从页面后面的 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 的逐步教程说明了上述函数的使用。

    【讨论】:

      【解决方案3】:

      我有一个解决方案:

      HERE

      这实际上每 3 秒重新加载一个 iframe,但由于基本原则适用,因此可以轻松地根据您的需要进行 1 次重新加载...

      【讨论】:

        猜你喜欢
        • 2014-03-23
        • 2015-03-11
        • 2013-03-20
        • 1970-01-01
        • 2011-12-22
        • 1970-01-01
        • 2015-03-04
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多