简体   繁体   中英

Pass window object across pages

Page A will open Page B, Page B will open Page C. Once Page C is loaded, close Page A.

In Page A, open up Page B :

var newWindowChild; 
$("#submitButton").click(function () {                                             newWindowChild = window.open('about:blank', 'TheNewWindow');
});

in Page C, how can i close Page A ? Is that possible to pass the newWindowChild across the pages from Page A to Page C, and do something like this? :

window.close(newWindowChild);

You could use Web Worker to achieve that. Below you can find a nice tutorial explaining how to use it.

http://www.sitepoint.com/javascript-shared-web-workers-html5/

-Page C can postMessage "Page A Close"

-Page A can listen to the above Message and trigger window.close()

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