简体   繁体   中英

Is it possible to use JavaScript to jump from one open page to another?

Sorry if this is naive question.

I heard in HTML5 there is inter page communication with JavaScript. I was wondering if it is possible to use JavaScript to let the focus jump from one page to another page it's having communication with?

For example, if I have one page A send some data to the other page B so that page B is updated after receiving the data, can I have page B (or tab B) brought to the front (before all other windows/tabs in z-order), without having to let the user click page B?

Thanks.

PS I don't want page B to reload and lose changes made by the user via changing the DOM.

Yes you can, use this code by using focus.. here is the complete code

var win=window.open("url");
win.focus();

You can also add parameters, here is the code

var win = window.open("url","name","width=700,height=700,top=200,left=300,resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no");
win.focus();

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