Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 792
Jitu Avatar asked May 25 '12 13:05

Jitu


People also ask

How do I get a pop up URL?

Open UiExplorer, and get the selector of that popup. Use an On Element Appear activity, put in the selector of that popup. in the On element Appear activity, place a Get Attribute activity, “url” to get the url of the popup.

How do you get the current URL with JavaScript?

If you're using JavaScript in the browser you can get the full current URL by using window. location. href .

How do I get a URL for a pop up window in Chrome?

query( { windowId: windowReference.id }, function callback(tabs) { var popup = tabs[0]; $log. debug("Popup URL:", popup. url); } );

What is the JavaScript command for a popup window?

The syntax to open a popup is: window. open(url, name, params) : url. An URL to load into the new window.


1 Answers

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.

like image 112
hugomg Avatar answered Oct 26 '22 23:10

hugomg