IE Conditional Comments not working? Check IE7.bat

Sep 01 2006

Recently I’ve been having all sorts of problems getting my standalone versions of Internet Explorer (5, 5.5, 6 and 7) to work correctly.

I use IE conditional comments to deliver ‘fix’ stylesheets to those browsers, but I was finding that IE was just ignoring anything inside the conditional comments. Fed up with this, today I have finally tracked down and fixed the problem.

IE7.bat

If you follow the instructions in Position Is Everything’s Taming Your Multiple IE Standalones article, there is a section covering some registry hacks to force standalone versions to use their correct version vector when interpreting conditional comments. Basically if you remove or rename the ‘IE’ registry key, the app configures itself from internal files and gets its version right.

Unfortunately, if you are using the standalone IE7 which runs from Jon Galloway’s batch file, it will overwrite the registry key when it starts up and shuts down, thus screwing your other standalone versions. To fix this, simply comment out or delete the relevant lines from the IE7.bat file in the folder that you extracted the IE7 installation into:

  1. ECHO Removing IE7 registry key and set the version vector to "7.0000".
  2. > %TEMP%.\IE7Fix.reg ECHO REGEDIT4
  3. >>%TEMP%.\IE7Fix.reg ECHO.
  4. >>%TEMP%.\IE7Fix.reg ECHO [-HKEY_CLASSES_ROOT\CLSID\{C90250F3-4D7D-4991-9B69-A5C5BC1C2AE6}]
  5. >>%TEMP%.\IE7Fix.reg ECHO [-HKEY_CLASSES_ROOT\Interface\{000214E5-0000-0000-C000-000000000046}]
  6. >>%TEMP%.\IE7Fix.reg ECHO [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Version Vector]
  7. >>%TEMP%.\IE7Fix.reg ECHO "IE"="7.0000"
  8. >>%TEMP%.\IE7Fix.reg ECHO.
  9. :: Merge the REG file to delete the IE7 standalone entry
  10. REGEDIT /S %TEMP%.\IE7Fix.reg

That section sets the version vector to 7, and these two reset it to 6 when IE7 is shut down:

  1. :: Merge the REG file to delete the IE7 standalone entry
  2. REGEDIT /S %TEMP%.\IE7Fix.reg
  3. :: Delete the temporary REG file
  4. DEL %TEMP%.\IE7Fix.reg
  1. :: Set the old version vector "6.0000".
  2. > %TEMP%.\IE7Fix.reg ECHO REGEDIT4
  3. >>%TEMP%.\IE7Fix.reg ECHO.
  4. >>%TEMP%.\IE7Fix.reg ECHO [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Version Vector]
  5. >>%TEMP%.\IE7Fix.reg ECHO "IE"="6.0000"
  6. >>%TEMP%.\IE7Fix.reg ECHO.
  7. REGEDIT /S %TEMP%.\IE7Fix.reg
  8. DEL %TEMP%.\IE7Fix.reg
  9.  

Deleting those three chunks of code doesn’t seem to have any adverse effects on running multiple versions of Internet Explorer, and fixes all conditional comment interpretation in all versions.

Jon Galloway has also released a standalone installer and batch file for IE7 Beta 3 which could also solve this issue.

Filed under: GeneralTechnology'; ?>.

Digg this article

Bookmark this article with del.icio.us

Previously: Comment spam

Next: BarCamp London - Day One


Comments

Jon Galloway
2932 days ago

This is fixed in the IE7 Standalone release for RC1. Rather than try to update the version vector registry key, I just remove it. From what I read (and based on user feedback), IE can figure out the version without the registry key.

#1
Matthew Pennell
2932 days ago

Cheers, Jon – thought it might be something like that.

#2