简体   繁体   中英

Opening a popup window in the middle of the screen

I have this little script and this function. I need to open a popup window every 15 minutes, like a reminder. How can I put the target to be a popup window in the middle of the screen?

setTimeout(openUrl, 54000);
setInterval(openUrl, 54000);

function openUrl(){
   window.open('http://google.com');
}

You can modify the size of th opening window, if you do so, it'll be opening as a real popup

here's the code:

function openUrl(){
    window.open('http://google.com', 'test', 'height=100px;width=100px');

}

window.open has properties for the size and location. Example:

window.open('http://google.com', '_blank', 'height=400,width=400,top=400,left=400');

More Information

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