I'm opening a window like this:
var w = window.open("", "window-name", opts);
Then I create an URL using some dynamic data and set the window to that URL like this:
w.location.href = url;
My problem is that I need to retrieve the URL I previously set to the window later for editing. Doing this doesn't work:
var url = w.location.href;
Because that's a security violation in my case and triggers an exception.
I can't just save the URL as a "global" variable since this needs to work across pages. I don't want to use cookies, because the URL should be reset when the window closes. Using cookies would add more complexity since it forces me to do cleanup before the window closes, and it adds bug risks. I will use it as a last resort.
Is there any way to retrieve the URL of a window instance after the URL has been set to something on a different domain?