最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - Get current url of the popup window with javascript - Stack Overflow

programmeradmin3浏览0评论

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?

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?

Share Improve this question asked May 25, 2012 at 13:59 JituJitu 2841 gold badge3 silver badges15 bronze badges 2
  • 1 It is possible with Javascript, if the Javascript runs on the page of the URL. You said it is a third party page. If you are trying to get the URL from a third party page that the user was redirected to from your page - I don't think this is possible. – Nivas Commented May 25, 2012 at 14:02
  • No, javascript runs on our page and not on the third party page. – Jitu Commented May 25, 2012 at 14:04
Add a comment  | 

2 Answers 2

Reset to default 21

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.

Google is your friend ;D

 var newURL = window.location.protocol + "://" + window.location.host + "/" 
              + window.location.pathname;
发布评论

评论列表(0)

  1. 暂无评论