hello, I am dealing with a web login, that once logged in via internet explorer, javascript after authentication closes the parent login window and creates a new internet explorer window (it terminates the login window, and shows you a new window, disconnected from client error on original ie instance). I am able to use the code below to identify the window and determine which window I need to address after the window close occurs:
It is pretty annoying trying to handle that Javascript. Essentially, I want to control the browser on a form, exactly like a web browser control. The problem I have found while trying to use the web browser control, is it is forced to close and I have not been able to handle the new window event correctly. I tried passing a cookie back to the web browser control, perhaps incorrectly, and re-navigating to the intranet url. Suffice to say it did not work:
Things I have thought of and have tried so far:
- WebBrowserControl - keeping the popup in the same window. It crashes after javascript tries to close/format the control
- Unsuccessfully pass a cookie back from IE to the web browser control, then renav the control
- Handle New Window Event (Crashes once the JS runs)
However, by identifying the IE window containing the URL of the page I want, I can set that window to be an object then control it that way- but its not as fancy as having it as a web browser control. I would have to have a form seperate from the IE instance, say, using mshtml form side to control the browser. My other idea is to handle the hwnd of that window and force it on my form. Any suggestions for the right direction? Thanks..
Code:
For Each ie As SHDocVw.InternetExplorer In shellWindows
'test for correct window here
Next
It is pretty annoying trying to handle that Javascript. Essentially, I want to control the browser on a form, exactly like a web browser control. The problem I have found while trying to use the web browser control, is it is forced to close and I have not been able to handle the new window event correctly. I tried passing a cookie back to the web browser control, perhaps incorrectly, and re-navigating to the intranet url. Suffice to say it did not work:
Code:
'ie as object = internetexplorer window
htmldoc = ie.Document
getcookie = htmldoc.cookie
'then later
webbrowsercontrol1.document.cookie = getcookie
webbrowsercontrol1.navigate(intraneturl)
- WebBrowserControl - keeping the popup in the same window. It crashes after javascript tries to close/format the control
- Unsuccessfully pass a cookie back from IE to the web browser control, then renav the control
- Handle New Window Event (Crashes once the JS runs)
However, by identifying the IE window containing the URL of the page I want, I can set that window to be an object then control it that way- but its not as fancy as having it as a web browser control. I would have to have a form seperate from the IE instance, say, using mshtml form side to control the browser. My other idea is to handle the hwnd of that window and force it on my form. Any suggestions for the right direction? Thanks..