Get current url of the popup window with javascript

后端 未结 2 812
南方客
南方客 2020-12-20 18:06

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 part

相关标签:
2条回答
  • 2020-12-20 18:12

    Google is your friend ;D

     var newURL = window.location.protocol + "://" + window.location.host + "/" 
                  + window.location.pathname;
    
    0 讨论(0)
  • 2020-12-20 18:30

    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.

    0 讨论(0)
提交回复
热议问题