snipt

Ctrl+h for KB shortcuts

JavaScript

Detect IE6 and show top warning

1
2
3
4
$.browser.version = $.browser.msie && parseInt($.browser.version) == 6 && window.XMLHttpRequest ? "7.0" : $.browser.version;
  if ($.browser.msie && parseInt(jQuery.browser.version) < 7) {
    $("#LayoutContainer").css("margin-top", "0em");
    $("#LayoutContainer").prepend('<div style="background-color:#FFFFE1; border: 1px #A0A0A0 solid; font-size:75%; padding: 0.2em; margin-bottom:0.3em; ">We don't support IE6 browser</div>');
https://snipt.net/embed/67efd117cfcd0a28dcebd61e78dd1751/
https://snipt.net/raw/67efd117cfcd0a28dcebd61e78dd1751/
67efd117cfcd0a28dcebd61e78dd1751
js
JavaScript
4
2016-09-25T03:25:55
True
False
False
/api/public/snipt/18233/
detect-ie6-and-show-top-warning
<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 id="L-1"><a name="L-1"></a><span class="nx">$</span><span class="p">.</span><span class="nx">browser</span><span class="p">.</span><span class="nx">version</span> <span class="o">=</span> <span class="nx">$</span><span class="p">.</span><span class="nx">browser</span><span class="p">.</span><span class="nx">msie</span> <span class="o">&amp;&amp;</span> <span class="nb">parseInt</span><span class="p">(</span><span class="nx">$</span><span class="p">.</span><span class="nx">browser</span><span class="p">.</span><span class="nx">version</span><span class="p">)</span> <span class="o">==</span> <span class="mi">6</span> <span class="o">&amp;&amp;</span> <span class="nb">window</span><span class="p">.</span><span class="nx">XMLHttpRequest</span> <span class="o">?</span> <span class="s2">&quot;7.0&quot;</span> <span class="o">:</span> <span class="nx">$</span><span class="p">.</span><span class="nx">browser</span><span class="p">.</span><span class="nx">version</span><span class="p">;</span> </span><span id="L-2"><a name="L-2"></a> <span class="k">if</span> <span class="p">(</span><span class="nx">$</span><span class="p">.</span><span class="nx">browser</span><span class="p">.</span><span class="nx">msie</span> <span class="o">&amp;&amp;</span> <span class="nb">parseInt</span><span class="p">(</span><span class="nx">jQuery</span><span class="p">.</span><span class="nx">browser</span><span class="p">.</span><span class="nx">version</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">7</span><span class="p">)</span> <span class="p">{</span> </span><span id="L-3"><a name="L-3"></a> <span class="nx">$</span><span class="p">(</span><span class="s2">&quot;#LayoutContainer&quot;</span><span class="p">).</span><span class="nx">css</span><span class="p">(</span><span class="s2">&quot;margin-top&quot;</span><span class="p">,</span> <span class="s2">&quot;0em&quot;</span><span class="p">);</span> </span><span id="L-4"><a name="L-4"></a> <span class="nx">$</span><span class="p">(</span><span class="s2">&quot;#LayoutContainer&quot;</span><span class="p">).</span><span class="nx">prepend</span><span class="p">(</span><span class="s1">&#39;&lt;div style=&quot;background-color:#FFFFE1; border: 1px #A0A0A0 solid; font-size:75%; padding: 0.2em; margin-bottom:0.3em; &quot;&gt;We don&#39;</span><span class="nx">t</span> <span class="nx">support</span> <span class="nx">IE6</span> <span class="nx">browser</span><span class="o">&lt;</span><span class="err">/div&gt;&#39;);</span> </span></pre></div> </td></tr></table>
coding, ie6, jquery

PHP

ie redirect

1
2
3
4
5
6
<?php
$br = strtolower($_SERVER['HTTP_USER_AGENT']);
if(ereg("msie 5", $br) or ereg("msie 6", $br) or ereg("msie 7", $br)) {
   header("location: http://blog.webdev.ge/");
}
?>
https://snipt.net/embed/d07de1ccbe209af53c53ff4ce33cefa0/
https://snipt.net/raw/d07de1ccbe209af53c53ff4ce33cefa0/
d07de1ccbe209af53c53ff4ce33cefa0
php
PHP
6
2016-09-27T09:04:24
True
False
False
/api/public/snipt/16864/
ie-redirect
<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> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a><span class="nv">$br</span> <span class="o">=</span> <span class="nb">strtolower</span><span class="p">(</span><span class="nv">$_SERVER</span><span class="p">[</span><span class="s1">&#39;HTTP_USER_AGENT&#39;</span><span class="p">]);</span> </span><span id="L-3"><a name="L-3"></a><span class="k">if</span><span class="p">(</span><span class="nb">ereg</span><span class="p">(</span><span class="s2">&quot;msie 5&quot;</span><span class="p">,</span> <span class="nv">$br</span><span class="p">)</span> <span class="k">or</span> <span class="nb">ereg</span><span class="p">(</span><span class="s2">&quot;msie 6&quot;</span><span class="p">,</span> <span class="nv">$br</span><span class="p">)</span> <span class="k">or</span> <span class="nb">ereg</span><span class="p">(</span><span class="s2">&quot;msie 7&quot;</span><span class="p">,</span> <span class="nv">$br</span><span class="p">))</span> <span class="p">{</span> </span><span id="L-4"><a name="L-4"></a> <span class="nb">header</span><span class="p">(</span><span class="s2">&quot;location: http://blog.webdev.ge/&quot;</span><span class="p">);</span> </span><span id="L-5"><a name="L-5"></a><span class="p">}</span> </span><span id="L-6"><a name="L-6"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
ie6, ie7, ie8, redirect

CSS

IE7 display inline-block parse hack

1
2
3
4
5
6
7
8
/*Taken from: http://flipc.blogspot.com/2009/02/damn-ie7-and-inline-block.html*/
div.content_block{
	display: inline-block; /*The way other browsers work correctly*/
	/*IE7*/
	zoom: 1; /*Meaningless for other than IE*/
	*display: inline; /*Asterisk parse hack, ignored by smarter browsers*/
	_height: Xpx; /*IE6 only parse hack, where X is the desired height*/
}
https://snipt.net/embed/95d6e7003f3fe6b319ed28aa5cc8cfc0/
https://snipt.net/raw/95d6e7003f3fe6b319ed28aa5cc8cfc0/
95d6e7003f3fe6b319ed28aa5cc8cfc0
css
CSS
8
2016-09-25T12:14:25
True
False
False
/api/public/snipt/14168/
ie7-display-inline-block-parse-hack
<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> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="c">/*Taken from: http://flipc.blogspot.com/2009/02/damn-ie7-and-inline-block.html*/</span> </span><span id="L-2"><a name="L-2"></a><span class="nt">div</span><span class="nc">.content_block</span><span class="p">{</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">display</span><span class="o">:</span> <span class="k">inline</span><span class="o">-</span><span class="k">block</span><span class="p">;</span> <span class="c">/*The way other browsers work correctly*/</span> </span><span id="L-4"><a name="L-4"></a> <span class="c">/*IE7*/</span> </span><span id="L-5"><a name="L-5"></a> <span class="n">zoom</span><span class="o">:</span> <span class="m">1</span><span class="p">;</span> <span class="c">/*Meaningless for other than IE*/</span> </span><span id="L-6"><a name="L-6"></a> <span class="o">*</span><span class="k">display</span><span class="o">:</span> <span class="k">inline</span><span class="p">;</span> <span class="c">/*Asterisk parse hack, ignored by smarter browsers*/</span> </span><span id="L-7"><a name="L-7"></a> <span class="n">_height</span><span class="o">:</span> <span class="n">Xpx</span><span class="p">;</span> <span class="c">/*IE6 only parse hack, where X is the desired height*/</span> </span><span id="L-8"><a name="L-8"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
css, ie6, ie7

JavaScript

IE6 Browser detection

1
2
3
if ($.browser.msie && $.browser.version=="6.0") {
 //do this for ie6
}
https://snipt.net/embed/8d6118b1cdff8bc59e462494aa9be101/
https://snipt.net/raw/8d6118b1cdff8bc59e462494aa9be101/
8d6118b1cdff8bc59e462494aa9be101
js
JavaScript
3
2016-09-29T07:06:11
True
False
False
/api/public/snipt/13393/
ie6-browser-detection
<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></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="k">if</span> <span class="p">(</span><span class="nx">$</span><span class="p">.</span><span class="nx">browser</span><span class="p">.</span><span class="nx">msie</span> <span class="o">&amp;&amp;</span> <span class="nx">$</span><span class="p">.</span><span class="nx">browser</span><span class="p">.</span><span class="nx">version</span><span class="o">==</span><span class="s2">&quot;6.0&quot;</span><span class="p">)</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="c1">//do this for ie6</span> </span><span id="L-3"><a name="L-3"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
"browser detection", ie6, jquery

CSS

double margin bug fix

1
2
3
4
5
6
7
.floatbox {
	float: left;
	width: 150px;
	height: 150px;
	margin: 5px 0 5px 100px;
	display: inline;
}
https://snipt.net/embed/77df80ff7d40c0a572d0025c17b3de29/
https://snipt.net/raw/77df80ff7d40c0a572d0025c17b3de29/
77df80ff7d40c0a572d0025c17b3de29
css
CSS
7
2016-09-26T12:49:06
True
False
False
/api/public/snipt/12969/
double-margin-bug-fix
<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> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nc">.floatbox</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="k">float</span><span class="o">:</span> <span class="k">left</span><span class="p">;</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">width</span><span class="o">:</span> <span class="m">150px</span><span class="p">;</span> </span><span id="L-4"><a name="L-4"></a> <span class="k">height</span><span class="o">:</span> <span class="m">150px</span><span class="p">;</span> </span><span id="L-5"><a name="L-5"></a> <span class="k">margin</span><span class="o">:</span> <span class="m">5px</span> <span class="m">0</span> <span class="m">5px</span> <span class="m">100px</span><span class="p">;</span> </span><span id="L-6"><a name="L-6"></a> <span class="k">display</span><span class="o">:</span> <span class="k">inline</span><span class="p">;</span> </span><span id="L-7"><a name="L-7"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
ie6
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.