Fix for  IE9 in compatibility mode 

Moved IE conditional statements to body to prevent ignoring the X-UA-Compatible tag by IE
Fixes #6163