window.parent.location在Mac上的Safari中不起作用 [英] window.parent.location does not work in Safari on Mac

查看:559
本文介绍了window.parent.location在Mac上的Safari中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好专家

我在Mac上的Safari中遇到了JavaScript问题.

我有一个服务器端重定向逻辑,可以使用

Hello Experts

I am facing a javascript issue in Safari on Mac.

I have a server side redirection logic from where I am injecting a page redirect script using

window.parent.location=''MyPage02.aspx'';


从其中注入页面重定向脚本
在所有浏览器中都可以正常工作,但在Mac上的Safari中却不能.这是我在C#中用于ASP.NET代码隐藏页的代码.



This works fine in all browsers but not in Safari on Mac. Here is my code in C# for a ASP.NET codebehind page.

if (condition == false)
 {
  Response.Write("<script type=\"text/javascript\"/>window.parent.location = 'MyPage02.aspx';</script>");
 }



有专家建议吗?

请注意,由于此页面是在其他页面的iframe中调用的,因此我无法使用Response.Redirect. Response.Redirect在同一iFrame中(而不是(父)资源管理器窗口中)打开新页面.



Any expert advice ?

Please note that I cannot use Response.Redirect since this page is called in a iframe on some other page. Response.Redirect opens the new page in the same iFrame instead of the (parent) explorer window.

推荐答案

请尝试以下操作:
try this :
window.parent.location.href = 'MyPage02.aspx';


或:


or :

window.parent.window.navigate('MyPage02.aspx');


这篇关于window.parent.location在Mac上的Safari中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆