Cristi
Cristi

Reputation: 439

javascript url of a popup

I start a popup with 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.

Thank you.

Upvotes: 0

Views: 662

Answers (2)

PleaseStand
PleaseStand

Reputation: 32122

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.

Upvotes: 1

Mikhail Nasyrov
Mikhail Nasyrov

Reputation: 898

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.

Upvotes: 1

Related Questions