简体   繁体   中英

Open popup from Chrome Extension on Dual monitor

I have a Google Chrome Extension which uses a background process to pop a browser window.

This works OK except for when I have Dual monitors.

Chrome is running on monitor 2. The popup however always occurs on monitor 1 (I want it to open on the monitor where chrome is running).

not matter what I do with window.open parameters it still opens on monitor 1.

You can see in my code I've tried forcing the left to 2000 as an experiment (monitor 1 is 1366 wide). It goes to the right-corner of monitor 1 no matter how high this setting is.

var ilinkWindow = window.open("popup.html", "extension_popup", "width=300,height=500,status=no,scrollbars=yes,resizable=no,top=0,left=2000");
ilinkWindow.focus();

as @wOxxOm says use chrome.windows.create.

That worked for me.

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