I have a window I'm opening with a Javascript function:
function newwindow() { window.open('link.html','','width=,height=,resizable=no'); }
I need it that once the new window opens that the focus returns to the original window. How can I do that? And where do I put the code - in the new window, or the old one? Thanks!
In JavaScript, window. The window. open() method is used to open a new browser window or a new tab depending on the browser setting and the parameter values.
Window open() Method. You can use JavaScript to launch a new window. The window. open() method, which allows you to open up new browser window without navigating away from the current page.
This is known as a 'pop-under' (and is generally frowned upon... but I digress).. It should give you plenty to google about
You probably want to do something like:
var popup = window.open(...); popup.blur(); window.focus();
Which should set the focus back to the original window (untested - pinched from google). Some browsers might block this technique.
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