简体   繁体   中英

Communication between two web browser windows

I need to create web application which must have two separate web browser windows to comfort usage. And events on each of them must cause action on another. The app will be on html5, perhaps with websockets on client side and Java with glassfish on server side. Is there any way to cross browser window communication or some another solution for this problem?

Yes, I described a lot of ways here:

How is it possible to share single js resource between browser tabs?

If the browser support is not so important for you, then you can use shared webworkers . The next option to use storage event to exchange data, one implementation is intercom.js for that. The most supported way to use cookies BNC Connector does that.

The best way to solve this problem is to store the information on the server side and have the web application communicate with the server (with JavaScript I expect).

You can have the web page "poll" the server every set period (eg 5 seconds) to see if there is an event or message to handle.

I used postMessage before - but not very heavily, worth a shot.
See post and demo at: http://robertnyman.com/2010/03/18/postmessage-in-html5-to-send-messages-between-windows-and-iframes/
Also see http://benalman.com/projects/jquery-postmessage-plugin/ for jQuery postMessage

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