<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>quirksmode &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/quirksmode/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>jQuery browser and OS detection plugin</title>
		<link>/2009/07/16/jquery-browser-and-os-detection-plugin/</link>
		<comments>/2009/07/16/jquery-browser-and-os-detection-plugin/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 13:50:42 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[detection]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[os]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[quirksmode]]></category>

		<guid isPermaLink="false">/?p=689</guid>
		<description><![CDATA[Browser/OS detection with jQuery As I wrote in my recent post I simply use the PPK BrowserDetect object to find out the browser/OS of the client. Actually I&#8217;m pretty sure there&#8217;s a similar jQuery plugin based again on that code from Quirksmode.org, but however I decided to write a simple plugin for jQuery wrapping it &#8230; <a href="/2009/07/16/jquery-browser-and-os-detection-plugin/" class="more-link">Continue reading <span class="screen-reader-text">jQuery browser and OS detection plugin</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/07/27/jquery-debug-plugin/" rel="bookmark" title="jQuery debug plugin">jQuery debug plugin </a></li>
<li><a href="/2010/02/01/writing-a-jquery-plugin-part-2-sample-plugin/" rel="bookmark" title="Writing a jQuery plugin &#8211; (part 2). Sample plugin.">Writing a jQuery plugin &#8211; (part 2). Sample plugin. </a></li>
<li><a href="/2010/02/16/jquery-tooltip-plugin/" rel="bookmark" title="jQuery tooltip plugin!">jQuery tooltip plugin! </a></li>
<li><a href="/2010/02/17/clickoutside-jquery-plugin/" rel="bookmark" title="clickoutside jQuery plugin">clickoutside jQuery plugin </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Browser/OS detection with jQuery</h2>
<p>As I wrote in my recent <a title="jQuery OS detection" href="/2009/07/04/jquery-os-detection/" target="_self">post</a> I simply use the <a title="PPK BrowserDetect object" href="http://www.quirksmode.org/js/detect.html" target="_blank">PPK BrowserDetect object</a> to find out the browser/OS of the client. Actually I&#8217;m pretty sure there&#8217;s a similar jQuery plugin based again on that code from <a title="Quirks Mode" href="http://www.quirksmode.org/" target="_blank">Quirksmode.org</a>, but however I decided to write a simple plugin for jQuery wrapping it into a closure and exporting it in the &#8220;$&#8221; object.</p>
<p><a href="/wp-content/uploads/2009/07/jquery-client-detect-source.png"><img class="alignnone size-full wp-image-692" title="jquery-client-detect-source" src="/wp-content/uploads/2009/07/jquery-client-detect-source.png" alt="" width="430" height="257" srcset="/wp-content/uploads/2009/07/jquery-client-detect-source.png 430w, /wp-content/uploads/2009/07/jquery-client-detect-source-300x179.png 300w" sizes="(max-width: 430px) 100vw, 430px" /></a></p>
<h2>Demo</h2>
<p>You can see full working example <a title="jquery client detect" href="http://stoimen.com/jquery.client.plugin/" target="_blank">here</a>.</p>
<p><a href="/wp-content/uploads/2009/07/jquery-client-detect.png"><img class="alignnone size-full wp-image-690" title="jquery-client-detect" src="/wp-content/uploads/2009/07/jquery-client-detect.png" alt="" width="430" height="150" srcset="/wp-content/uploads/2009/07/jquery-client-detect.png 430w, /wp-content/uploads/2009/07/jquery-client-detect-300x104.png 300w" sizes="(max-width: 430px) 100vw, 430px" /></a></p>
<h2>Installation</h2>
<p>You must add a link to <a title="jquery client detect js" href="http://stoimen.com/jquery.client.plugin/jquery.client.js.zip" target="_blank">jquery.client.js</a> after the jquery.js file in your code:</p>
<pre lang="html4strict" escaped="true">&lt;html&gt;
&lt;body&gt;
 &lt;div id="os"&gt;&lt;/div&gt;
 &lt;div id="browser"&gt;&lt;/div&gt;
 &lt;script src="./jquery-1.3.2.js"&gt;&lt;/script&gt;
 &lt;script src="./jquery.client.js"&gt;&lt;/script&gt;
 &lt;script&gt;
  $('#os').html("&lt;b&gt;" + $.client.os + "&lt;/b&gt;");
  $('#browser').html("&lt;b&gt;" + $.client.browser + "&lt;/b&gt;");
 &lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>Now there&#8217;s a $.client object containing two strings with OS and browser, they can be referenced with:</p>
<pre lang="javascript">$.client.browser
$.client.os</pre>
<p>You can append this code after you jquery.js installation. And if you&#8217;re on Firefox you simply can test with the <strong>console</strong> object:</p>
<p><a href="/wp-content/uploads/2009/07/jquery-client-detect-firebug-console.png"><img class="alignnone size-full wp-image-691" title="jquery-client-detect-firebug-console" src="/wp-content/uploads/2009/07/jquery-client-detect-firebug-console.png" alt="" width="430" height="114" srcset="/wp-content/uploads/2009/07/jquery-client-detect-firebug-console.png 430w, /wp-content/uploads/2009/07/jquery-client-detect-firebug-console-300x79.png 300w" sizes="(max-width: 430px) 100vw, 430px" /></a></p>
<h2>Download</h2>
<p>You can download the sample code from <a title="jquery client plugin download" href="http://stoimen.com/jquery.client.plugin/jquery.client.js.zip">here</a>.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/07/27/jquery-debug-plugin/" rel="bookmark" title="jQuery debug plugin">jQuery debug plugin </a></li>
<li><a href="/2010/02/01/writing-a-jquery-plugin-part-2-sample-plugin/" rel="bookmark" title="Writing a jQuery plugin &#8211; (part 2). Sample plugin.">Writing a jQuery plugin &#8211; (part 2). Sample plugin. </a></li>
<li><a href="/2010/02/16/jquery-tooltip-plugin/" rel="bookmark" title="jQuery tooltip plugin!">jQuery tooltip plugin! </a></li>
<li><a href="/2010/02/17/clickoutside-jquery-plugin/" rel="bookmark" title="clickoutside jQuery plugin">clickoutside jQuery plugin </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/07/16/jquery-browser-and-os-detection-plugin/feed/</wfw:commentRss>
		<slash:comments>40</slash:comments>
		</item>
		<item>
		<title>jQuery OS detection</title>
		<link>/2009/07/04/jquery-os-detection/</link>
		<comments>/2009/07/04/jquery-os-detection/#respond</comments>
		<pubDate>Sat, 04 Jul 2009 08:35:10 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[os detection]]></category>
		<category><![CDATA[quirksmode]]></category>

		<guid isPermaLink="false">/?p=648</guid>
		<description><![CDATA[JavaScript libraries and OS Particularly in that case I&#8217;m using jQuery which is enough famous, so I&#8217;m not going to introduce it, but however you can use any library, and this remains of your choice. The interesting part here is that I didn&#8217;t find a jQuery specific OS detecting plugin. Reference to the roots: www.quirksmode.org &#8230; <a href="/2009/07/04/jquery-os-detection/" class="more-link">Continue reading <span class="screen-reader-text">jQuery OS detection</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/06/17/build-a-list-tree-with-the-beauty-of-jquery/" rel="bookmark" title="Build a List Tree with the Beauty of jQuery">Build a List Tree with the Beauty of jQuery </a></li>
<li><a href="/2009/09/29/jquery-stop-an-ajax-call/" rel="bookmark" title="jQuery &#8211; stop an ajax call!">jQuery &#8211; stop an ajax call! </a></li>
<li><a href="/2010/06/19/speed-up-the-jquery-code-selectors-cache/" rel="bookmark" title="Speed Up the jQuery Code: Selectors&#8217; Cache">Speed Up the jQuery Code: Selectors&#8217; Cache </a></li>
<li><a href="/2009/11/03/ajax-datatypes-in-jquery-format-and-access/" rel="bookmark" title="AJAX dataTypes in jQuery. Format and access.">AJAX dataTypes in jQuery. Format and access. </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>JavaScript libraries and OS</h2>
<p>Particularly in that case I&#8217;m using <a title="JQuery" href="http://jquery.com/" target="_blank">jQuery</a> which is enough famous, so I&#8217;m not going to introduce it, but however you can use any library, and this remains of your choice. The interesting part here is that I didn&#8217;t find a jQuery specific OS detecting plugin.</p>
<h2>Reference to the roots: <a title="Quirks Mode" href="http://www.quirksmode.org/" target="_blank">www.quirksmode.org</a></h2>
<p>Well the guru PPK has the right answer, which is working with every JavaScript library &#8230; because it&#8217;s pure JavaScript itself.<span id="more-648"></span></p>
<p>Quote from <a title="Quirks Mode Os Detection" href="http://www.quirksmode.org/js/detect.html" target="_blank">http://www.quirksmode.org/js/detect.html</a></p>
<blockquote>
<pre>1. var BrowserDetect = {
2. init: function () {
3.	this.browser = this.searchString(this.
&gt;&gt; dataBrowser) || "An unknown browser";
4.	this.version = this.searchVersion(
&gt;&gt; navigator.userAgent)
5.		|| this.searchVersion(
&gt;&gt; navigator.appVersion)
6.		|| "an unknown version";
7.	this.OS = this.searchString(this.dataOS)
&gt;&gt; || "an unknown OS";
8. },
9. searchString: function (data) {
10.	for (var i=0;i &lt; data.length;i++)	{
11.		var dataString = data[i].string;
12.		var dataProp = data[i].prop;
13.		this.versionSearchString =
&gt;&gt; data[i].versionSearch || data[i].identity;
14.		if (dataString) {
15.			if (dataString.indexOf(
&gt;&gt; data[i].subString) != -1)
16.				return data[i].identity;
17.		}
18.		else if (dataProp)
19.			return data[i].identity;
20.	}
21. },
22. searchVersion: function (dataString) {
23.	var index = dataString.indexOf(
&gt;&gt; this.versionSearchString);
24.	if (index == -1) return;
25.	return parseFloat(dataString.substring(
&gt;&gt; index+this.versionSearchString.length+1));
26. },
27. dataBrowser: [
28.	{
29.		string: navigator.userAgent,
30.		subString: "Chrome",
31.		identity: "Chrome"
32.	},
33.	{ 	string: navigator.userAgent,
34.		subString: "OmniWeb",
35.		versionSearch: "OmniWeb/",
36.		identity: "OmniWeb"
37.	},
39.	{
40.		string: navigator.vendor,
41.		subString: "Apple",
42.		identity: "Safari",
43.		versionSearch: "Version"
44.	},
45.	{
46.		prop: window.opera,
47.		identity: "Opera"
48.	},
49.	{
50.		string: navigator.vendor,
51.		subString: "iCab",
52.		identity: "iCab"
53.	},
54.	{
55.		string: navigator.vendor,
56.		subString: "KDE",
57.		identity: "Konqueror"
58.	},
59.	{
60.		string: navigator.userAgent,
61.		subString: "Firefox",
62.		identity: "Firefox"
63.	},
64.	{
65.		string: navigator.vendor,
66.		subString: "Camino",
67.		identity: "Camino"
68.	},
69.	{		// for newer Netscapes (6+)
70.		string: navigator.userAgent,
71.		subString: "Netscape",
72.		identity: "Netscape"
73.	},
74.	{
75.		string: navigator.userAgent,
76.		subString: "MSIE",
77.		identity: "Explorer",
78.		versionSearch: "MSIE"
79.	},
80.	{
81.		string: navigator.userAgent,
82.		subString: "Gecko",
83.		identity: "Mozilla",
84.		versionSearch: "rv"
85.	},
86.	{ 		// for older Netscapes (4-)
87.		string: navigator.userAgent,
88.		subString: "Mozilla",
89.		identity: "Netscape",
90.		versionSearch: "Mozilla"
91.	}
92. ],
93. dataOS : [
94.	{
95.		string: navigator.platform,
96.		subString: "Win",
97.		identity: "Windows"
98.	},
99.	{
100.		string: navigator.platform,
101.		subString: "Mac",
102.		identity: "Mac"
103.	},
104.	{
105.		   string: navigator.userAgent,
106.		   subString: "iPhone",
107.		   identity: "iPhone/iPod"
108.    },
109.	{
110.		string: navigator.platform,
111.		subString: "Linux",
112.		identity: "Linux"
113.	}
114. ]
115.
116. };
117. BrowserDetect.init();</pre>
</blockquote>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/06/17/build-a-list-tree-with-the-beauty-of-jquery/" rel="bookmark" title="Build a List Tree with the Beauty of jQuery">Build a List Tree with the Beauty of jQuery </a></li>
<li><a href="/2009/09/29/jquery-stop-an-ajax-call/" rel="bookmark" title="jQuery &#8211; stop an ajax call!">jQuery &#8211; stop an ajax call! </a></li>
<li><a href="/2010/06/19/speed-up-the-jquery-code-selectors-cache/" rel="bookmark" title="Speed Up the jQuery Code: Selectors&#8217; Cache">Speed Up the jQuery Code: Selectors&#8217; Cache </a></li>
<li><a href="/2009/11/03/ajax-datatypes-in-jquery-format-and-access/" rel="bookmark" title="AJAX dataTypes in jQuery. Format and access.">AJAX dataTypes in jQuery. Format and access. </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/07/04/jquery-os-detection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
