Thursday, September 12, 2013

Detect IE 10 for styling purposes

I found an interesting way on the internet to detect ie10 by it's document mode.


if (Function('/*@cc_on return document.documentMode===10@*/')()){
    document.html.className+=' ie10';
    $("html").addClass("ie10");


The first line in the function is a javascript method, while the second is a jQuery function. Feel free to use any one of them, depending if you use Javascript or jQuery for your code and also which one works for your code.

Another tip is to use the html tag to insert classes depending on the type of browser, to make future browser styling issues easier to solve.

No comments:

Post a Comment