Link to home
Start Free TrialLog in
Avatar of tom3030
tom3030

asked on

Deadlock between two browser controls

I have a situation with a Vb.Net project where two WebBrowser controls are getting caught in a deadlock, because Browser1 is waiting for a page on Browser 2 to be ready so it can open a print dialog box (see Javascript code snippet) and Browser 2 can't finish loading a page because the Javascript loop on Browser 1 is consuming the available CPU cycles for the main thread (and causing everything to lock up). Although this does not happen between two normal I.E. windows the main browser thread cannot be in stand-alone I.E. - it has to be in the WebBrowser control. My questions are :-

Can two webBrowser control windows be run in seperate threads (i.e. can a popup window that maintains session state of the main window run seperately from the main UI)?

If not, can JavaScript execution or the browser control itself be paused (mid function) within a WebBrowser control via .Net code (i.e. can I suspend a javascript 'loop' while something else completes)?

If not can a popup/child page be opened in I.E. that maintains the session from the WebBrowser control (i.e. so a user does not have to log in again in this window)?

If not can a geniune pause/sleep be achieved in javascript (i.e. for not hogging CPU resources in a nested loop)? (This would be a last resort as I do not own or have control of the Javascript)
//Javascript from first page (in browser control 1)
printWin = window.open("Print.htm","Print","toolbar=no,menubar=yes,scrollbars=yes,resizable=yes");
//SOME CODE REMOVED
do {} //Causing lockup.
while (printWin.document.readyState!='complete')

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of tom3030
tom3030

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial