DaneBigham
asked on
Web Browser embedded in MS Access form hangs after logging into website
I have a Web Browser object embedded in an MS Access (2013) form. The code behind the form navigates to a specific website, applies login credentials, and navigates further within the website. This has all been working fine. However, now Access freezes after the login sequence. The login seems to execute properly, as the expected next page appears in the browser object, but that's when Access freezes. I've repeated the navigation independently in an IE browser (versions 9 and 11) with nothing unusual happening.
Troubleshooting is difficult. There's no line of code triggering the problem on my end. Other properties of the browser object:
OLE Class: Microsoft Web Browser
Class: Shell.Explorer.2
Any help is greatly appreciated.
Troubleshooting is difficult. There's no line of code triggering the problem on my end. Other properties of the browser object:
OLE Class: Microsoft Web Browser
Class: Shell.Explorer.2
Any help is greatly appreciated.
<<This has all been working fine. However, now Access freezes after the login sequence. >>
It's probably a change in the web site then. There are two things to be aware of:
1. With the Web Browser control is that by default, it emulates IE7 With a registry tweak, you can achieve emulations for different versions. the key for 32 bit is:
HKLM\Software\Microsoft\In ternet Explorer\Main\FeatureContr ol\FEATURE _BROWSER_E MULATION
The value for the key are:
7000: IE7 Emulation
8000: IE8 Emulation
8888: Force IE8 Emulation
9000: IE9 Emulation
9999: Force IE9 Emulation
10000: IE10 Emulation
10001: Force IE10 Emulation
11000: IE11 Emulation
11001: Force IE11 Emulation
You can find a full discussion here:
https://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version
2. You can't execute any page that has a client side Java script in it. The way around this is to write the page to a temp file, then point the browser control to the temp file. I have not done this myself, but it was discussed here:
https://www.experts-exchange.com/questions/28272041/classic-google-maps-not-working-in-vba-webbrowser-control.html?anchorAnswerId=39588958#a39588958
and doing this may be an option for you.
While not a specific answer, I think the above two points will get you pointed in the right direction. I would try a later emulation first since that's easy and see if it solves the problem. If not, then you'll need to figure out what the page is doing (can't help with that as I am not a web developer).
HTH,
Jim.
It's probably a change in the web site then. There are two things to be aware of:
1. With the Web Browser control is that by default, it emulates IE7 With a registry tweak, you can achieve emulations for different versions. the key for 32 bit is:
HKLM\Software\Microsoft\In
The value for the key are:
7000: IE7 Emulation
8000: IE8 Emulation
8888: Force IE8 Emulation
9000: IE9 Emulation
9999: Force IE9 Emulation
10000: IE10 Emulation
10001: Force IE10 Emulation
11000: IE11 Emulation
11001: Force IE11 Emulation
You can find a full discussion here:
https://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version
2. You can't execute any page that has a client side Java script in it. The way around this is to write the page to a temp file, then point the browser control to the temp file. I have not done this myself, but it was discussed here:
https://www.experts-exchange.com/questions/28272041/classic-google-maps-not-working-in-vba-webbrowser-control.html?anchorAnswerId=39588958#a39588958
and doing this may be an option for you.
While not a specific answer, I think the above two points will get you pointed in the right direction. I would try a later emulation first since that's easy and see if it solves the problem. If not, then you'll need to figure out what the page is doing (can't help with that as I am not a web developer).
HTH,
Jim.
ASKER
Upon further testing, this isn't a problem with the code. Creating a new form with the browser object and navigating manually results in the same problem. I've also tried this in VB.net with the same result. One other symptom...not sure if it means anything...CPU goes through the roof as Access hangs.
I don't think this is a client-side javascript problem. I've had no issues with other websites running such code. I'm piqued by the IE7 thing. I opened the registry to the .../FEATURE_BROWSER_EMULAT ION element. Do I need to create a new key? None of the existing keys seemed relevant.
Thanks in advance.
I don't think this is a client-side javascript problem. I've had no issues with other websites running such code. I'm piqued by the IE7 thing. I opened the registry to the .../FEATURE_BROWSER_EMULAT
Thanks in advance.
Yes, if the key is not there, you need to create it.
Jim.
Jim.
ASKER
What should be the name of the key, 'msaccess.exe'?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I forced emulation to IE9 and it worked. Thanks so much for your help.
Glad to hear that resolved it for you.
Jim.
Jim.
Can you show us your code to navigate and login?
Do you use the Webbrowser events such as document complete?
Do you have any loops with which you wait for something to be ready or complete?