简体   繁体   中英

Background window popup

I am opening up a new window popup and I want to keep it in background and keep focus on my current window. I am doing something like this but it doesn't work.

var currentWindow = window;
var newWindow = window.open("http://www.xyz.com");
currentWindow.focus();

I will appreciate suggestions or any kind of help.

If the window doesn't ever need to be seen, you could instead use a hidden iframe.

var iframe = document.createElement("iframe");
iframe.src = "http://xyz.com";
iframe.style.display = "none";

You can blur the background window

var win = window.open('http://www.xyz.com');
win.blur();
window.focus();

This should work for you in the application

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM