Jump to content

[Solved] Forcing IE9 into IE8 Browser Mode?


icu
 Share

Recommended Posts

Right so IE9 breaks AutoIt scripts... and the Devs are working on it and the Beta may fix things.

Mean time the best 'work around' solution offered from my research of the forum is to set IE9 into an older and compatible mode for AutoIt (F12 and then select the option). Problem is I can't seem to find a UDF for setting the Browser Mode to 'IE8' and while I can set the Document Mode to IE8 (via sending Alt+8) this doesn't fix the problem of running AutoIt IE scripts. I've tried the UDF code offered at this posting however both sets of code offered does not seem to work. After spending an afternoon searching Google for solutions (and not finding anything), then experimenting with Exit's and supersonic's code, and my own stuff from scratch I've come back with nothing so this is a general shout out for help.

Does anyone have a UDF that specifically forces IE9 into IE8 Browser Mode?

Please share if you've got one that is working with IE 9.0.10 running on Win7 64bit.

I don't want to have to learn Scrapy or buy Screen Scraper Studio or use Sikuli if I already know AutoIt :-(

Edited by icu
Link to comment
Share on other sites

  • Moderators

You're being specific with Win7 x64 IE 9.0.10 .

IMO, I don't think IE.au3 should be used outside a "controlled" environment.

So... Why no just run a virtual machine with with XP or something that runs IE6/7 that you know works, instead of spending days ( = $ ) trying to figure out a total re-write of the IE.au3 library is needed?

Unless you're "FLUENT" in Javascript/Ajax/JQuery, no sense in beating the bush ( trust me! ).

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Good suggestion.

Also you could use an embedded IE perhaps, which I do not think would be IE9 either.

It follows default if you're referring to Shell.Explorer.2

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Thank you both for your replies,

@SmOke_N: Yeah a VM running legacy software is another work around idea and is a solution I found when doing my Google research. As for being specific I thought it would be best to actually state what windows and IE version AutoIt is breaking on. Of course a VM will work but I wanted a 'portable' code solution across all my PCs (WinXP, Vista and Win7)--that is, a single compiled AutoIt script that would not be Windows or IE dependent.

However since posting I may have found a solution but it needs more time and energy to test. Basically it would involve creating an account with spoon.net since they have a browser sandbox and then using AutoIt to use the command prompt to execute spoon.net and launch IE8. Once IE is launched, get AutoIt to attach to IE8 and do its thing. I don't have time now to start scripting for this but I thought I would quickly put a post up in case others are also looking for a solution right now.

Link to comment
Share on other sites

Embedded IE will fix your problem because it will be IE7 rendered (max IE8).

If you dont want embedded, here is a way to force all IE instances to render as <9

$64Bit = ""
If @ProcessorArch = "X64" Then
$64Bit = "64"
EndIf
If StringLeft(RegRead("HKLM" & $64Bit & "SOFTWAREMicrosoftInternet ExplorerVersion Vector", "IE"), 1) > 8 Then ;Check for version 9 or later


$wshNetwork = ObjCreate("WScript.Network")
$struser = $wshNetwork.Username
$objWMIService = ObjGet("winmgmts:.rootcimv2")
$objAccount = $objWMIService.Get('Win32_UserAccount.Name="' & $struser & '",Domain="' & @ComputerName & '"')
RegWrite("HKU" & $64Bit & "" & $objAccount.SID & "SoftwareMicrosoftInternet ExplorerBrowserEmulation", "AllSitesCompatibilityMode", "REG_DWORD", 1)
RegWrite("HKU" & $objAccount.SID & "SoftwareMicrosoftInternet ExplorerBrowserEmulation", "AllSitesCompatibilityMode", "REG_DWORD", 1)
EndIf

I picked it up somewhere on the forum and edited a bit.

Credits to the unknown user.

TESTED: WIN XP, WIN7, WIN8

BTW. Your avatar??

Edited by milos83
Link to comment
Share on other sites

@milos83 THANK YOU SO MUCH!

However your code needs updating to change @ProcessorArch to @OSArch as per this The modified code is below if any others stumble upon this post.

$64Bit = ""
If @OSArch = "X64" Then
$64Bit = "64"
EndIf
If StringLeft(RegRead("HKLM" & $64Bit & "SOFTWAREMicrosoftInternet ExplorerVersion Vector", "IE"), 1) > 8 Then ;Check for version 9 or later
$wshNetwork = ObjCreate("WScript.Network")
$struser = $wshNetwork.Username
$objWMIService = ObjGet("winmgmts:.rootcimv2")
$objAccount = $objWMIService.Get('Win32_UserAccount.Name="' & $struser & '",Domain="' & @ComputerName & '"')
RegWrite("HKU" & $64Bit & "" & $objAccount.SID & "SoftwareMicrosoftInternet ExplorerBrowserEmulation", "AllSitesCompatibilityMode", "REG_DWORD", 1)
RegWrite("HKU" & $objAccount.SID & "SoftwareMicrosoftInternet ExplorerBrowserEmulation", "AllSitesCompatibilityMode", "REG_DWORD", 1)
EndIf

Again I can't express my gratitude for your post! Just out of interest what code modifications would need to be made to force IE from version 7 to 8 or back to 9? The code above currently sets IE to version 7 and writing to registry is beyond my knowledge of Windows. Also, what was the original forum post that you took this code from?

Lastly, my avatar pic has multilayered meanings to me. PM me if you are curious.

Kind regards,

icu

Link to comment
Share on other sites

@milos83 THANK YOU SO MUCH!

However your code needs updating to change @ProcessorArch to @OSArch as per this The modified code is below if any others stumble upon this post.

$64Bit = ""
If @OSArch = "X64" Then
$64Bit = "64"
EndIf
If StringLeft(RegRead("HKLM" &amp; $64Bit &amp; "SOFTWAREMicrosoftInternet ExplorerVersion Vector", "IE"), 1) > 8 Then ;Check for version 9 or later
$wshNetwork = ObjCreate("WScript.Network")
$struser = $wshNetwork.Username
$objWMIService = ObjGet("winmgmts:.rootcimv2")
$objAccount = $objWMIService.Get('Win32_UserAccount.Name="' &amp; $struser &amp; '",Domain="' &amp; @ComputerName &amp; '"')
RegWrite("HKU" &amp; $64Bit &amp; "" &amp; $objAccount.SID &amp; "SoftwareMicrosoftInternet ExplorerBrowserEmulation", "AllSitesCompatibilityMode", "REG_DWORD", 1)
RegWrite("HKU" &amp; $objAccount.SID &amp; "SoftwareMicrosoftInternet ExplorerBrowserEmulation", "AllSitesCompatibilityMode", "REG_DWORD", 1)
EndIf

Again I can't express my gratitude for your post! Just out of interest what code modifications would need to be made to force IE from version 7 to 8 or back to 9? The code above currently sets IE to version 7 and writing to registry is beyond my knowledge of Windows. Also, what was the original forum post that you took this code from?

Lastly, my avatar pic has multilayered meanings to me. PM me if you are curious.

Kind regards,

icu

I use @ProcessorArch because my Autoit version is old.

For reverting rendering

$64Bit = ""
If @OSArch = "X64" Then
$64Bit = "64"
EndIf

$wshNetwork = ObjCreate("WScript.Network")
$struser = $wshNetwork.Username
$objWMIService = ObjGet("winmgmts:.rootcimv2")
$objAccount = $objWMIService.Get('Win32_UserAccount.Name="' & $struser & '",Domain="' & @ComputerName & '"')
RegWrite("HKU" & $64Bit & "" & $objAccount.SID & "SoftwareMicrosoftInternet ExplorerBrowserEmulation", "AllSitesCompatibilityMode", "REG_DWORD", 0)
RegWrite("HKU" & $objAccount.SID & "SoftwareMicrosoftInternet ExplorerBrowserEmulation", "AllSitesCompatibilityMode", "REG_DWORD", 0)

Also, what was the original forum post that you took this code from?

Idk,Use search to find that post

Edited by milos83
Link to comment
Share on other sites

  • 2 years later...

I hope this bumps this post back to the top to get respondents but I need to revive this post. Will this still work today? Does this permanently switches the browser mode to below IE9 or does it do it permanently? I need to find a way to just temporary use IE8 during the execution of Autoit Script but retain the IE9 since I have sites that requires higher than IE8.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...