在window.open打开的页面里怎么获取来源URL?

GolYang 2008-12-03 03:29:15
在window.open打开的页面里怎么获取来源URL?
是不同域的。
document.referrer是空的。
window.opener.location也是空的。
Help。
...全文
602 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
lobster_lshj 2008-12-03
  • 打赏
  • 举报
回复
传参数吧,跨域的获取不到
GolYang 2008-12-03
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 wujinjian2008n 的回复:]
location.href //获取自身url

window.parent.opener.location.href //获取上一个页面的url
[/Quote]

一样取不到,请注意是不同域的。
wujinjian2008n 2008-12-03
  • 打赏
  • 举报
回复
location.href //获取自身url

window.parent.opener.location.href //获取上一个页面的url
GolYang 2008-12-03
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 ocean_958 的回复:]
引用 4 楼 ocean_958 的回复:
parent.window.opener.localhost.href


去掉href
[/Quote]



去掉不去掉都不行。换成location也不行。
ocean_958 2008-12-03
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 ocean_958 的回复:]
parent.window.opener.localhost.href
[/Quote]

去掉href
ocean_958 2008-12-03
  • 打赏
  • 举报
回复
parent.window.opener.localhost.href
GolYang 2008-12-03
  • 打赏
  • 举报
回复
opener.location.href不行!

大家聊聊怎么能取到
lanxk 2008-12-03
  • 打赏
  • 举报
回复
跨域是获取不到的opener.location的
window.open打开的窗口自然也没有 referer
bluefcxt 2008-12-03
  • 打赏
  • 举报
回复
opener.location.href不行?

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧