<?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>A K Chauhan's Blog &#187; Browsers</title>
	<atom:link href="http://www.akchauhan.com/tag/browsers/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.akchauhan.com</link>
	<description>PHP, MySql, JavaScript, JQuery, Prototype, Drupal, HTML, CSS and more...</description>
	<lastBuildDate>Sun, 04 Jul 2010 20:19:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Getting Browser Information using JQuery</title>
		<link>http://www.akchauhan.com/getting-browser-information-using-jquery/</link>
		<comments>http://www.akchauhan.com/getting-browser-information-using-jquery/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 14:26:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Browsers]]></category>

		<guid isPermaLink="false">http://www.akchauhan.com/?p=422</guid>
		<description><![CDATA[One day every browser will act in same way and support same web standards. However, that&#8217;s not today. In a sufficiently complicated web application, it&#8217;s important to know which browser user is using so we can know which JavaScript functions are available and which CSS properties it supports. Here, I am showing how you know [...]]]></description>
			<content:encoded><![CDATA[<p>One day every browser will act in same way and support same web standards. However, that&#8217;s not today. In a sufficiently complicated web application, it&#8217;s important to know which browser user is using so we can know which JavaScript functions are available and which CSS properties it supports. Here, I am showing how you know about the users browser using JQuery. We can find lot of information about users browser like its name, version number etc through jQuery.</p>
<p>At the highest level, JQuery offers an object called browser that contains some simple flags to determine which one of the major browsers is currently being used &#8211; Safari, Opera, IE, or Mozilla.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">   $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> browser<span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">browser</span>.<span style="color: #660066;">mozilla</span><span style="color: #009900;">&#41;</span>
      browser <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Firefox&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">msie</span><span style="color: #009900;">&#41;</span>
      browser <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Internet Explorer&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">browser</span>.<span style="color: #660066;">opera</span><span style="color: #009900;">&#41;</span>
      browser <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Opera&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">browser</span>.<span style="color: #660066;">safari</span><span style="color: #009900;">&#41;</span>
      browser <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Safari&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">else</span>
      browser <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Unknown&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#browserName'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>browser<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Create a DIV so in your page so you can see the output of this JavaScript.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"> <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;browserName&quot;</span>&gt;</span>Your Browser: <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>When you execute the code, the output should look something like below. If you are using Safari.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">Your Browser: Safari</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.akchauhan.com/getting-browser-information-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
