【问题标题】:HTML refresh page from iframe来自 iframe 的 HTML 刷新页面
【发布时间】:2012-09-09 19:58:40
【问题描述】:

我有一个简单的网页,分为三个 iframe A、B、C。

iframe B 执行 Ajax 请求,它应该刷新页面以重定向到我的登录页面。 显然,登录页面只出现在 iframe B 中。有没有办法重定向整个页面?

【问题讨论】:

    标签: html ajax iframe


    【解决方案1】:

    这应该可行。

    <script>
        Window.top.location = 'new url';
    </script>
    

    【讨论】:

      【解决方案2】:

      对 top.location 的简单检查不会起作用吗?

      <script type="text/javascript">
          <!--
              if (top.location!= self.location) {
                  top.location = self.location.href
              }
          //-->
      </script>
      

      【讨论】:

      • 您的解决方案非常好。但如果我有这样的配置:top
      猜你喜欢
      • 1970-01-01
      • 2013-03-22
      • 2021-05-15
      • 1970-01-01
      • 2011-04-28
      • 2013-05-23
      • 2012-06-18
      • 2013-03-20
      相关资源
      最近更新 更多