Is it possible to have javascript communication between 2 WebBrowsers in winform
I have a winform with 2 WebBrowser开发者_如何学运维 control. Is there a way for one page to communicate with the other directly?
For example in HTML and frames, one page can access window.parent.frames[1].document for example.
Not directly, because those will be two separate browser instances. You can however write some communication layer of your own. Obviously you'll have to tailor the websites you are showing for this as well.
Technically it is feasible like the web chat between two or more people in Gmail or Facebook.
This is not a simple task, but today there is the HTML5's websockets or if you target older browsers as well, you could poll the server on both frames and share some statuses that you read every few seconds.
In any case, this is a messaging(string) communication (eg: a stringified JSON) that you can pass.
But you will never be able to access the DOM of the other browser/frame.
精彩评论