简体   繁体   中英

Pass data between two web pages on the same machine with no postback

I am creating a web page that offers the user the ability to "undock" a control into a new browser window. When the user selects a value in the new window, I need to have the new page pass data to the parent page and update some information on the screen. Basically, I need to keep the data displayed in sync. I am using jQuery and AJAX to avoid any postbacks and I would want to do the same for this. For example: The user does a search for "foo" on parent page and wants to see the results in a larger format. He clicks the "undock" button and larger window opens with the search results. The user selects a value from the child window and the parent window is updated as well. I would think I could accomplish this with AJAX but have yet to find a good post explaining it. Does anyone know how this can be done?

Also, if the child windows gets closed and I don't capture the close because of a browser crash, is there a way the parent can check to see if the child is still there?

Thanks!

您可以尝试使用socket.io ,但是对于您的情况来说可能会过分...

您不能在子窗口中使用window.parent吗?

To do your undock, are you using window.open? You can use window.opener to communicate between two windows: http://www.w3schools.com/jsref/prop_win_opener.asp

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