This question already has answers here:
How to Detect Browser Window /Tab Close Event?
(8 answers)
Closed 7 years ago.
I know about window.onbeforeunload, but that also executes when the user clicks on a link or refreshes the page, while I want my function to only execute when the browser or tab is closed. Is there a way to do that?
AFAIK the only options are unload and onbeforeunload so I would say the answer to your questions is "no".
https://developer.mozilla.org/en-US/docs/Web/Events/unload
Related
This question already has answers here:
How can I detect a user about the exit the page? [closed]
(3 answers)
Closed 2 years ago.
Does anyone know if it's possible to show a popup model on page exit(close tab/refresh/go back) with images and text using Javascript/jQuery?
The closest thing I found was beforeunload but it seems to only show an alert prompt with a predefined message.
I don't think modern browsers support a custom message in the beforeunload modal popup. Check this post for a discussion on browser compatibility
This question already has answers here:
Javascript Bring window to front if already open in window.open?
(8 answers)
Closed 5 years ago.
I got a javascript that fills in the modal html. I would like after that to maximize the window if it is minimized or to focus that tab if it is maximized and not focused.
Anybody knows how to do it?
Note: I'd like it to also work in older IE if possible if not I am pleased with the new one also
Thank you all!
window.open("https://www.google.com");
This will open a new window and you can change the url to suit your needs
This question already has answers here:
Making a window pop under in chrome
(8 answers)
Closed 7 years ago.
I want to open a pop-under window on click, but I want to open it behind the current window.
I google this and found nothing useful about my problem.
Is there a way to do it?
Perhaps a simple path setting is what you need. Use this within a javascript sequence:
path = window.document.URL;
window.open(path,"_self");
This question already has answers here:
Use Browser Search (Ctrl+F) through a button in website?
(3 answers)
Closed 9 years ago.
Does javascript allow for to trigger a "find" action with a keyword on the current page?
No, there's no cross-browser way to do this. (I don't even know of one browser that exposes that functionality.)
This question already has answers here:
How can I close a browser window without receiving the "Do you want to close this window" prompt?
(18 answers)
Closed 8 years ago.
When we open a form in a new window, we would like to click a button to close the window without alert box.
Is it possible?
Any help is appreciated.
Thanks alot
if you are talking about window.open() function then just try to use window.close()