I'm debugging an SSO app and I need to prevent the window from closing so I can inspect the requests and responses. I tried to disable Javascript but the login flow requires Javascript. Network > Preserve Log doesn't work either. Pinning the tab didn't work either. There are several redirects before it closes. I do not have access to the code of the SSO server. How can I prevent a script from closing the window?
Use the Pin tab option to keep Prevent Close available in Chrome. To make this as painless as possible, I recommend pinning this website to your browser then moving the tab out of the way. To do that open Prevent Close, and then right-click the tab with your mouse. From the context menu select Pin tab.
Answers. There is no way to prevent a user from closing HIS browser. All you can do is display a message, as Jagan posted, but that won't prevent them from closing their browser if they ignore your message.
Scripts may close only the windows that were opened by it. A workaround now is redirect user to another page rather than close the window, you could redirect user to a notification page to show "The items has been closed successfully" using window. location.
All you need to do is select the window and then hit 'Ctrl + Space' from your keyboard, and the window will stay there as it is on top of all other windows.
I was able to do it by opening the link in an Incognito Window. When it tried to close itself, Chrome gave the warning
Scripts may close only the windows that were opened by it.
I didn't have a script open the window in the first place. Instead I was using target="_blank"
, but Chrome may have equated that with a script. (window.opener
was set.)
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