Internet Explorer. The bane of most web developers' lives. How often have we built a site and looked back content with our efforts, only to have that satisfaction whipped away when opening Internet Explorer?
We'll leave aside the fact that Internet Explorer is actually a pretty good browser these days (from IE10 things were really starting to look up, but even IE9 supports media queries and some parts of the HTML5 spec). Even if you're following a progressive enhancement approach (which you should be!), testing in all major browsers is a key part of a frontend dev's life and can't be ignored.
(Image Credit: http://www.telegraph.co.uk/technology/microsoft/11480692/RIP-Internet-Explorer-Twitter-mourns-and-mocks-death-of-Microsofts-browser.html)
At Zoocha, none of our developers run Windows (unsurprisingly). The majority run Ubuntu although OSX is actually creeping in slowly at the edges. This is great for testing in Firefox, Chrome and Opera, but Internet Explorer is notably missing from here. To cope with this we have a raft of laptops each with a different version of IE / Windows installed so we can test all our work. Of course with an ever-growing dev team there are times when one laptop per version isn't enough. Also we have several remote devs who have no access to the test lab.
Luckily for us, Microsoft is aware of the issue of browser testing and now we have Modern.ie. This is a collection of Windows Virtual Machines pre-installed with pretty much all the options you'd need for testing in Internet Explorer, right back to IE6 (older devs still shudder at the mention of that). There are images for all the popular VM environments such as VirtualBox and VMWare, and the beauty is these are available cross platform. Simply download the version you want (they're pretty big), unpack and get testing.
This approach is fine for testing publicly visible sites, but being a virtual machine you'll find you can't access your local dev builds. Bummer!
There are a few options here:
- Use a tool like ngrok or localtunnel
- If you use Vagrant for your dev environment, you can use Vagrant Share
- Edit the hosts file on your Windows machine
The last is possibly the easiest as you don't have to install anymore software or change your dev environment. Just like you would when you create a virtual host on your local dev, you can add the site to your Windows machine's hosts file. The only difference here is you need to reference your dev machines LOCAL IP (e.g the one served by your router) rather than 127.0.0.1
.
In Windows, the hosts file is located in C:\Windows\System32\drivers\etc\hosts. (Yep). In Vista / Win7 / Win8+, you need to open Notepad as an admin to be able to edit this (right click on the icon and choose 'Run as Administrator' to do this). Then simply add your site to your hosts file:
192.168.1.22 zoocha.dev
Save, and boom! You can now test away in IE, on your Mac / Linux box, against your local code. Cue several hours of slightly reduced testing frustration!