简体   繁体   English

弹出窗口的javascript网址

[英]javascript url of a popup

I start a popup with window.open("link","name"). 我从window.open(“ link”,“ name”)开始弹出。 I don't have control on the popup. 我无法控制弹出窗口。

The popup it's then redirecting to another link. 然后将其弹出窗口重定向到另一个链接。

How can I get the final link of the popup ? 如何获得弹出窗口的最终链接? The final link it's on another domain. 最终链接在另一个域上。

with popup_window_object.location.href I can set the link but I can't get it. 使用popup_window_object.location.href可以设置链接,但无法获取。

Thank you. 谢谢。

You can't read a location from another domain because of security restrictions. 由于安全限制,您无法从其他域读取位置。 If the first content in the popup is your page, you can push a next popup's location into a variable of a parent window. 如果弹出窗口中的第一个内容是您的页面,则可以将下一个弹出窗口的位置推入父窗口的变量中。

The same-origin policy makes this impossible for privacy reasons. 出于隐私原因,同源策略使此操作成为不可能。 It would work if the final URL had the same hostname and port number as the page trying to get it, but since this is not the case, the code generates a security error. 如果最终到达的URL具有与尝试获取它的页面相同的主机名和端口号,这将起作用,但是由于并非如此,因此代码会产生安全性错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM