iframe页面中打开滴三方链接

iframe页面中打开滴三方链接

场景:在A界面中iframe嵌入界面B,在B界面中打开第三方链接C

1、最常用的方式window.location.href:
window.location.href = C;

说明:window.location.href 方式在window系统浏览器打开是有效的,在安卓手机浏览器打开也是有效的,在IOS系统手机中打开无效。

2、parent.location.href方式:
parent.location.href = C;

说明:parent.location.href方法在window系统浏览器打开是有效的,在安卓手机浏览器打开也是有效的,在IOS系统手机中打开有效。

3、top.location.href方式:
top.location.href = C;
听说还有这种方式,本人未测试过,有兴趣的工友也已试下。

如果对你有帮助,记得点个赞噢(~~)

猜你喜欢

转载自blog.csdn.net/start_sea/article/details/121145249