i can, thru code (javascript) automatically navigate to a site and have my hidden credentials get me in with no problem (and have the cookie)
however, on the next line of code when i try to redirect using (window.open) it doesn’t recognize that i’ve already got the cookie and then prompts me for credentials. Any ideas?
...
<form name="MyForm" action="#" method="post">
<input type="hidden" name="blah" value="blah" />
<input type="hidden" name="blah" value="blah" />
</form>
</div>
Using JavaScript we can communicate between browser windows given that we have a reference to each window. When a new window is created the the JavaScript method window.open() it returns a reference to the new window. The child window, also has a reference to the parent window that created it via the window.opener window object. These references allow the two windows to communicate with and manipulate each other.
To demonstrate how communicating between windows with cookies would work, lets assume we want to open a window, and then close it a few seconds later.
view plainprint?
The code will open a child window, and close it after 5 seconds using the reference to the child window and the method close(). However if we didn’t have a reference for some reason, we would not be able to invoke the close method. So lets see how it could be done with cookies:
view plainprint?
Here we open a window but do not save a reference. Then after 5 seconds we write ‘close’, to the cookie named ‘child’ (using the pseudo setCookie() function). This does not do anything by itself, but if the child window was expecting the cookie, it could close itself when it read ‘close’. Lets assume the following JS is in child.html.
view plainprint?
This would check the cookie every half a seconds and close the window if the cookie read ‘close’.
Using this method we can send any commands to any open windows and have them execute it without having a reference to that window.