snipt

Ctrl+h for KB shortcuts

JavaScript

Target IE10 with jQuery

1
2
3
4
//Detect IE10 and set an appropriate <html> class, considering that IE10 doesn't have conditional classes
if (/*@[email protected]*/false && document.documentMode === 10) {
    document.documentElement.className+=' ie-10';
}
https://snipt.net/embed/1c3e25e7e89355c0fcb858ac4deb06b9/
/raw/1c3e25e7e89355c0fcb858ac4deb06b9/
1c3e25e7e89355c0fcb858ac4deb06b9
js
JavaScript
4
2016-12-10T10:58:59
True
False
True
Mar 05, 2013 at 08:28 AM
/api/public/snipt/57032/
target-ie10-with-jquery
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">//Detect IE10 and set an appropriate &lt;html&gt; class, considering that IE10 doesn&#39;t have conditional classes</span> </span><span id="L-2"><a name="L-2"></a><span class="k">if</span> <span class="p">(</span><span class="cm">/*@[email protected]*/</span><span class="kc">false</span> <span class="o">&amp;&amp;</span> <span class="nb">document</span><span class="p">.</span><span class="nx">documentMode</span> <span class="o">===</span> <span class="mi">10</span><span class="p">)</span> <span class="p">{</span> </span><span id="L-3"><a name="L-3"></a> <span class="nb">document</span><span class="p">.</span><span class="nx">documentElement</span><span class="p">.</span><span class="nx">className</span><span class="o">+=</span><span class="s1">&#39; ie-10&#39;</span><span class="p">;</span> </span><span id="L-4"><a name="L-4"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
"internet explorer", browser, css, ie10, javascript, jquery

JavaScript

Target IE6-8 with JQuery

1
2
3
4
5
//http://webknight-nz.blogspot.com/2011/03/ie-9-detection-with-jquery.html
if(!$.support.htmlSerialize && !$.support.opacity) 
{
// IE6/7/8 code
}
https://snipt.net/embed/ca30f7f02d18f5b166d6514578d4b062/
/raw/ca30f7f02d18f5b166d6514578d4b062/
ca30f7f02d18f5b166d6514578d4b062
js
JavaScript
5
2019-07-02T16:27:56
True
False
False
Feb 12, 2013 at 01:24 PM
/api/public/snipt/43201/
target-ie6-8-with-jquery
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">//http://webknight-nz.blogspot.com/2011/03/ie-9-detection-with-jquery.html</span> </span><span id="L-2"><a name="L-2"></a><span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">$</span><span class="p">.</span><span class="nx">support</span><span class="p">.</span><span class="nx">htmlSerialize</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">$</span><span class="p">.</span><span class="nx">support</span><span class="p">.</span><span class="nx">opacity</span><span class="p">)</span> </span><span id="L-3"><a name="L-3"></a><span class="p">{</span> </span><span id="L-4"><a name="L-4"></a><span class="c1">// IE6/7/8 code</span> </span><span id="L-5"><a name="L-5"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
browser, jquery