There comes a time in every developer’s life where we have to do the unthinkable: open Internet Explorer. But if we’re not using Windows, where can we find it? Oh yeah, that’s right, IE doesn’t work on OS X.
We can perhaps use a service like BrowserStack, which is very good, but I find there’s always a bit of lag involved and who wants to spend money on testing Internet Explorer? Alternatively we can recreate what BrowserStack is doing on your own computer.
First, we’ll need to download VirtualBox for OS X hosts. VirtualBox is a program which allows you to create virtual computers on whichever OS you’re currently using. This means if you have a Windows XP CD lying around, you could be surfing the internet on your host machine (OS X) and have a window open which has Windows XP running in the background (your guest machine).
It’s okay if you don’t have a Windows CD lying around. Microsoft has once again (IE hacks, conditional comments) taken into account that their browser is–unique–and has released demo copies of their operating system along with every version of Internet Explorer all the way back to IE6 on a site called modern.ie specifically so designers can set up “virtual machines” (VMs) to test their websites on.
Now, you can either go through the semi-painful process of downloading all of these virtual machines from the modern.ie, then setting them up, or you can make use of a really handy GitHub project called ievms. Type
curl -s https://raw.githubusercontent.com/xdissent/ievms/master/ievms.sh | bash into your terminal and wait. After several minutes you can open up VirtualBox and all of the VMs you’ve installed will be sitting there, ready for you to “Start”.
Now there is the problem of actually accessing files that live on your host machine. For instance, you can’t just type file:///Users/cory/Desktop/foo/index.html into Internet Explorer on your guest machine and expect it to know where that is.
To do this, we’ll need to set up a localhost development server, and I’ve found the easiest way to do this is to simply
cd to your project from within Terminal, and then type:
python -m SimpleHTTPServer. Now open up localhost:8000 on your host machine (OS X) and you can see your site. Try it in IE on your guest machine however, and it won’t work–why?! Your guest machine doesn’t have Python running that server on it. Luckily, you can replace localhost:8000 with http://10.0.2.2:8000 and everything will work.
Now, you might be aware that IE (particularly older versions of IE) pale in comparison to Chrome with its DevTools, but if you search for Firebug Lite and install its bookmarklet to your Favorites Bar in IE, then you will at least have some sort of debugging at your disposal.
When you close your VM, you can “Save Machine State” (which saves every open window just the way you left it), or actually power off the VM.
I’ve certainly found that this is the fastest and most effective way of testing Internet Explorer on OS X. As a treat (and to challenge to yourself) now that you’re familiar with VirtualBox, try getting a working copy of Ubuntu on it and tinkering around. Have fun!