Answer the question
In order to leave comments, you need to log in
How to know if a window is open from the current domain if field access throws an exception?
I open a new window from the page w = window.open(). After user actions on a third-party domain, a page from the current domain should open. I need to seize this moment.
I watch w.location.hostname on the timer, and if the hostname matches the current one, I do something.
The problem is that accessing w.location.hostname gives "Error: Permission denied to access property 'hostname'". Of course, you can always wrap it in a try-catch, but that's not sporty. Maybe there is a way to determine, without exception, a page from the current domain?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question