Home > database >  Detect url of window that opened my angular application
Detect url of window that opened my angular application

Time:03-10

Is there a way in angular to know from where is my application been opened? I mean if my application is opened from another tab or window, how can I get the URL of window from where is doing the call? thanks

CodePudding user response:

If the other app is also yours, add some "place_id" to the URL to open your app. Different "place_id" from different places. And analyze it in the app via "window.location" or via router parameters.

CodePudding user response:

When a window/tab is opened from a different window/tab, you can access the address of opener using following js:

window.opener.location

The prerequisite to use that is that the link that opened the window has rel="opener" attribute, since modern browsers don't allow access to opener by default.

  • Related