Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

jquery - Get current url of the popup window with javascript

I had a webpage with a link, which opens a new page in a popup window. Everything is fine till here, The popup window contains credit card payment page held by some 3rd party server. After completing the payment flow the response is shown and there is change in the url.

I need to get that url.

Is it is possible in javascript?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The URL of a page is accessible through the location property of the window object. If you are visiting a site on the same subdomain as you , then you can get the address via

popupWindow.location.href

However, if the popup is from a third party, the same origin policy applies and you are not allowed to inspect the location.href of the popup. The only ways to bypass the same origin policy would involve cooperation from the third party.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...