扫码关注官方订阅号
点击一个链接,跳转到一个网站,原页面也会跳转,这是个什么原理??
就是这个网站 www.kubihai.com 不管是通过什么链接到网站首页的 只要是新窗口打开的
原页面就会跳转 , 是JS操作的吧 这是个什么原理 请高手解答
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...
window.opener
<!DOCTYPE html> <meta charset="utf-8" /> <title>测试页面</title> <a href="test.html" target="_blank">点我</a>
<!DOCTYPE html> <meta charset="utf-8" /> <title>跳转测试</title> <script type="text/javascript"> <!-- try{ document.write(window.opener.location); }catch(ex){ console.log(ex); } window.opener.location = 'http://lilydjwg.is-programmer.com/'; //--> </script>
在同源时能够访问到原页面地址。不同源的时候只能跳转而不能访问。
PS: 在 Firebug 中总是能够访问 window.opener 的各种属性,大概是因为 Firebug 是在 chrome 环境中运行的。
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
window.opener在同源时能够访问到原页面地址。不同源的时候只能跳转而不能访问。
PS: 在 Firebug 中总是能够访问
window.opener的各种属性,大概是因为 Firebug 是在 chrome 环境中运行的。