Like it or not, Internet Explorer (IE) 11 is not going away for a while. Even though Microsoft is ending support for the much-maligned web browser, there are still quite a few holdouts that will keep it going.
For example, some companies have created internal systems relying on IE’s proprietary scripting language and have assumed that technology will never change. Whatever the reasons, we as web developers must account for IE11 when doing our thing. At DEG, we only provide base-level support if the usage analytics don’t show that full support is necessary.
This, of course, leads to the question of “How in the world do I test for IE11?” It’s a question that gets even more difficult to answer when you realize that you can’t simply download it to use on your shiny new MacBook. So, what are you to do?
You have a few options, mostly dependent on whether you have money to spend. There is Browserstack, Parallels desktop, WINE, and a couple of other paid applications that allow you to run Windows programs on your Mac. Some, like Parallels, run the applications directly on your Mac, but you’ll need a Windows license to do so.
However, there’s an additional problem. To run IE11, you need an old version of Windows. The latest Windows 10 doesn’t include it anymore. That’s where something like Browserstack comes in handy. It will spin up an instance of many different operating systems (OS) that you can run various programs on and test. The big issue with Browserstack is that it’s run remotely. So, if you don’t have a top-notch internet connection—or even if you do—there is lag. Sometimes, a lot of lag.
My solution to these issues is to use VirtualBox. VirtualBox (VB) uses verification to create a whole new computer inside of your computer, allowing you to run Windows 8 in a container. More than that, it allows you to access your local files, and—most importantly for web development—it allows you to access your localhost from the virtual machine (VM). This is important when you’re doing rapid iterations in your web development where you’re reloading constantly. Best of all, it’s FREE!
Now that we know why we want to do this, let’s dive into the how.
The first thing you’ll need to do is download some software. Start by going to VB’s download page, but don’t download version 6. While it’s new and shiny, Oracle (VB’s creators and maintainers) has done updates that make it almost impossible to run older versions of Windows, which is what we want.
Instead, follow the link to the VB 5.2 builds and download the OS X host package and the extensions pack—you’ll need it, so save it somewhere you’ll be able to find it easily.
Now, we’ll need Windows and IE. You’ll remember that earlier I mentioned you would need to purchase a license to be able to run Windows. Well…that wasn’t entirely true. While you do need a license if you’re planning to use Windows for other things, Microsoft understands the need to test programs and that making things easier for developers means better programs for their platform.
As such, Microsoft provides VM images for testing purposes. Simply go to the Microsoft developer portal and choose the image you need. For this, we are going to use IE11 on Windows 8.1, so download it. I use a VM folder to store all my downloaded images. Once downloaded, you should go ahead and extract the ZIP archive. Be forewarned, it is a very large download (about 7GB). If you’re on Wi-Fi, you might want to go get a cup of coffee at this point or go for a 10K run.
Now, let’s get things installed. For VB, simply check on the downloaded file and it will walk you through the install, which is pretty standard.
Once installed, fire it up and go to VirtualBox > Preferences > Extensions, click on the add symbol, and navigate to the extensions file you downloaded earlier. Click Install—authenticate as an admin, if necessary—and you’re done. Congratulations!
You’re now able to run different OS’ in virtual environments on your Mac. One little side note: VB will tell you that there’s an update every time you open it. Just ignore it or disable it in the settings (Settings > Update), as the update is to upgrade to version 6, which we don’t want.
Let’s get Windows running now. Click the New icon at the top left of the VB screen.
On this screen, you’ll set a few basic options for your new VM. I would suggest increasing the memory size to around 8GB for performance reasons. Don’t max it out or your host machine won’t be able to run. Make sure you also select to use an existing virtual hard disk file and point it to the testing “.vmdk” file you extracted earlier. Now, click Create and let VB do its thing.
We’re almost ready to go, but we need to tweak a couple of settings in our new VM. For whatever reason, Windows has set the defaults for this box quite low and it impacts performance. Most notably, you get a lot of lag from the mouse input. To help fix this, click on the Settings gear at the top of the VB interface, then select Display. Make sure that the checkbox next to Enable 3D Acceleration is checked, and that Video Memory is set at the maximum limit. Click OK and let’s spin it up by selecting Start.
It will take a little while the first time you spin it up because Windows is being installed and started from scratch the first time. I’ve also had VB start in an itty-bitty window before. To fix that, click on View in the application bar and then Scaled Mode, as well as auto-resize guest display. With those set, you can resize the window to whatever size you need.
The next thing we’ll need to do is install the “VBoxGuestAdditions.iso” into our VM. The guest additions are a suite of tools from VB to help with integration with your host system. To install, simply go to Devices > Insert guest additions CD from the application menu. You’ll have to follow the installation in the guest (Windows) machine and then it’ll restart the machine for you.
Alight! We now have a fully functional Windows instance with IE11 already loaded and ready to go. The final thing to do is make it so it can connect to our host (Mac) instance of the localhost.
To accomplish this, we’ll need to get the machine’s default gateway and add it to the host file. If you’ve never had the pleasure of doing this on a Windows machine, don’t fear. It’s fairly simple, just follow along.
- Click the Windows menu icon (probably at either the top left or bottom left of the screen), then type “command prompt” and hit Enter.
- In the command window, type “ipconfig” and hit Enter. You’ll be presented with some basic information about your machine, including the default gateway. Take note of it.
- Click the Windows menu icon again, but this time type “notepad,” then right-click on the Notepad icon. Next, select Run as administrator and hit Yes, when prompted.
- Now, you’ll need to open C:\\Windows\System32\drivers\etc\hosts.conf (you may need to select Show All Files in the bottom right corner of the dialog screen).
- Add as the last line “YOUR_DEFAULT_GATEWAY localhost.” So, for example, if my default gateway was 10.2.2.2, I would write “10.2.2.2 localhost.”
- Select Save and you’re done!
You may have an issue where you can’t go directly to http://localhost. If you do, try going to your default gateway instead (e.g. http://10.2.2.2).
With all that work done, you now have access to IE11 to test locally and offline.