I'm using the below anchor tag on a JSP page to open another page from the same application, but the new window is not opened in the same session and instead it redirects to the login page of my application. Any clues why?
<a href="#" onclick="window.open('/path_to_same_page', '_blank',
'toolbar=0,status=0,resizable=1'); return false;">Click here...</a>
Its also a matter of fact the window. open creates a new window that shares session cookies.
Using Chrome's window. open() allows synchronous access to opened windows so it is convenient choice if you need to open a dialog or a preferences window.
How to check if an opened browser window is closed or not in JavaScript? To check if an opened browser window is closed, you can use the closed property in referenced window object in JavaScript. The property returns a boolean true if the window is closed and false if the window is in the opened state.
Try this workaround, not sure it will help but worth a shot:
<a href="/path_to_same_page" target="mywindow" onclick="window.open('/path_to_same_page', 'mywindow', 'toolbar=0,status=0,resizable=1');">Click here...</a>
By having this, the window won't get opened by script initially, but rather by the target
attribute.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With