Home > Website Development > Browser Testing on Windows 7

Browser Testing on Windows 7

This week I installed Windows 7 on my laptop and I discovered a very nice feature for browser testing (on that browser you all hate :) ). This is called XP Mode which allows you to run Internet Explorer 6, 7, and 8 all on the same machine.

Testing your web sites in Internet Explorer is so much harder than it should be. IE6, IE7, and IE8 have a healthy market share, yet it is impossible to test all three versions of the browser on a single machine. There are a number of software that allows you to test all 3 borwsers on one machine however they are all flawed and do not replicate the real environment, apart from the fact that the majority do not run on Vista, let alone Windows 7. The most reliable solution is to run each browser on a single machine.

How many of you use this solution? Very very few because nowadays web developers resort to using virtual machines such as VMware or VirtualBox. Virtual machines emulate a PC (guest) on your real PC (the host). You can also run a different OS on each virtual machine. The nice thing about virtual machines is that most of them are files on your hard disk and these can be moved, backed up, and even cloned easily on other PCs.

Installing Virtual PC and XP Mode

Please note that only users who have Windows 7 Professional, Enterprise, and Ultimate can install Virtual PC. For Windows 7 Home users can install Virtual PC, but they will need their own XP disk and you cannot use XP Mode Integration. For Windows Vista and XP users one can install Virtual PC 2007.

One must also note that to run XP Mode effectively one should have at least 2GB of RAM. It also needs hardware-assisted virtualization

  1. Check Your PC’s compatibility
    To run XP Mode effectively, I’d recommend at least 2GB of RAM. It’ll probably work with less, but it will be more of a chore to use. XP Mode requires hardware-assisted virtualization (HAV). This is supported by most modern processors, but it may need to be enabled in your BIOS. The BIOS menu is normally accessed by pressing DEL or ESC immediately after switching on your PC. Microsoft also provide a useful HAV detection tool.
  2. Download XP Mode and Virtual PC
    The downloads are available from the Microsoft Virtual PC page. After selecting your Windows 7 OS version and language, you’ll be presented with two download links:

    • Windows XP Mode
    • Windows Virtual PC

    Download and virus-scan both files before proceeding to the next step.

  3. Installation
    You must install XP Mode first! I realize this seems a little odd, but it’s what you need to do. Once it’s complete, install Virtual PC and reboot your PC.

Running XP Mode for the First Time

Your new XP VM can now be launched and configured.

  1. Start XP Mode
    To start XP Mode, choose Start > All Programs > Windows Virtual PC > Windows XP Mode. You’ll be prompted to enter the VM file location and a password for the XPMUser account—please keep the password safe!

    Click Next and you’ll be asked whether automatic updates should be enabled or disabled. I’d recommend disabling updates—you’ll have no need to automatically upgrade IE6 just yet. Click Next again and the XP Mode guest OS will install. After a few minutes, you’ll be presented with the fresh Windows XP screen.

  2. Install Updates
    You should now install the latest updates, but be very careful to avoid installing IE7 or IE8! You could also remove any unnecessary Windows components, such as Games, Media Player, MSN Messenger, and so on from the Add/Remove Windows Components panel in the Add or Remove Programs control panel.
  3. Configure the VM Resolution
    1. From the XP Start menu, click Run, enter mmc, and click OK.
    2. From the console, choose File > Add/Remove Snap-in. Select Group Policy Object Editor from the list and click the Add button.
    3. A dialog box is displayed and Local Computer should be listed in the Group Policy Object field. Leave as is and click Finish, then OK.
    4. Navigate to Local Computer Policy > Computer Configuration > Administrative Templates > Windows Components > Terminal Services, then double-click the Limit Maximum Color Depth setting. Choose Enabled and set Color Depth to 24-bit.
    5. Click OK several times to navigate your way out and close the console.
    6. Right-click on the desktop, choose Properties; select Settings and apply an appropriate screen resolution, such as 1024×768 in 32-bit color.
    7. Finally, from the VM menu, click Tools > Enable Integration Features.
  4. The XP Mode VM runs at an unusual 960×600 resolution with 16-bit color. Unless it’s changed, IE6 and IE7 will also run in 16-bit color mode and your subtly shaded web application will look a bit strange. Changing the resolution and color depth is a little unusual because XP Mode uses Windows Remote Desktop. From the VM menu, select Tools > Disable Integration Features. This will log you off XP and you’ll need to re-enter your password. Then, follow this procedure:

Once you’re done, it’s important to fully shut down the guest XP OS—click the window close button, choose Shut down, then click OK.
Hard Disk Differencing

VMware has a great facility for taking a snapshot of a VM and creating multiple clones. Each cloned VM is independent but all inherit from the same base installation. VirtualBox also allows cloning. Virtual PC offers a facility called hard disk differencing, that allows you to create any number of VMs from an existing hard disk image. Unfortunately, any changes to the original disk image will corrupt all inheriting VMs. However, we can use differencing to create two new VMs from our XP Mode disk image. One VM will be used for IE6 and the other will be used for IE7. You need to do the following:
  1. Create a New Virtual Machine: Start Virtual PC from Start > Programs > Windows Virtual PC > Virtual Machines then click Create virtual machine on the toolbar. Enter the name and location of your new VM, then clickNext.
  2. Configure RAM: The next screen asks how much RAM your VM requires. 256MB should be enough for just running Internet Explorer. Enter the amount and click Next.
  3. Configure Hard Disk: The next screen asks you to add a virtual hard disk. Choose Create a virtual hard disk using advanced options and click Next. Then choose the Differencing option. Click Next twice, then select your original XP Mode hard disk. This is a file named Windows XP Mode.vhd and is located where you originally installed XP Mode. Finally, clickCreate to save the VM and return to the Virtual Machines dialog.

Your new VM is now ready, but remember that you should create two: one for IE6 and one for IE7. Repeat the four steps above as necessary. Once your two VMs have been created, I’d recommend making the XP Mode hard disk file read-only (Windows XP Mode.vhd). That should ensure the file is protected from modifications if you accidentally boot your original XP Mode image.

Running IE6 from Windows 7

  1. Start the Virtual Machine:  Start your IE6 Virtual Machine by double-clicking its icon in the Virtual Machines folder (Start > All Programs > WindowsVirtual PC > Virtual Machines). You’ll need to log on with the XPMUser ID and password you entered when installing XP Mode.
  2. Configure XP and Internet Explorer: It’s a good time to change the VM screen resolution and configure IE6 as you want it. Developers should install the Microsoft Internet Explorer Developer Toolbar.
  3. Copy the IE Shortcut:  Right-click the XP Start button and select Explore All Users. Any shortcut you copy into this folder will be replicated in the Windows 7 Start menu. Therefore, create or copy an IE shortcut as necessary. After a few moments, a new folder containing the IE6 icon will appear in the Windows Virtual PC Start menu.
  4. Close the Virtual Machine: From the XP Start menu, choose Log Off. Close the window, but choose Hibernate from the drop-down list.
  5. Start IE6 from Windows 7: Click Start > Programs > Windows Virtual PC, then locate the newly created VM folder, and click the IE icon. The first time IE is run, you will be prompted for the XPMUser password. Assuming you keep your VM hibernated, IE6 will start within a few seconds every time you click its icon.

The same steps must be repeated for running IE7. However you need to download and install IE7.

You can now run IE6 from one VM disk, IE7 from the other VM disk, and IE8 as a native application from the same Windows 7 desktop.


Categories: Website Development
  1. No comments yet.
  1. No trackbacks yet.