Find Browser & it's version using jQuery

Find Browser & it's version using jQuery

Hi sir

I heard that JQuery have some method which can be used to find the Browser name & its version.

I need the code which checks the browser and if it is "Mozilla", it will show its version & & display some message in alert box.

Please provide me code ASAP.

View Answers

December 15, 2010 at 3:17 PM

Hi Samar

The code according to the description provided by you is given below :

<html>
<head>
  <style>
  p { color:green; font-weight:bolder; margin:3px 0 0 10px; }
  div { color:blue; margin-left:20px; font-size:14px; }
  span { color:red; }
  </style>
  <script src="jquery-1.4.2.js"></script>
</head>
<body>
    <p>Browser info:</p>
<script>
    jQuery.each(jQuery.browser, function(i, val) {
      $("<div>" + i + " : <span>" + val + "</span>")
                .appendTo(document.body);
    });
    //Alerts "Do stuff for firefox 3" only for firefox 3 browsers.
    jQuery.each(jQuery.browser, function(i, val) {
   if(i=="mozilla" && jQuery.browser.version.substr(0,3)=="1.9")
      alert("Do stuff for firefox 3")
    });
    //Set a CSS property to specific browser. 
  jQuery.each(jQuery.browser, function(i) {
   if($.browser.msie){
      $("#div ul li").css("display","inline");
   }else{
      $("#div ul li").css("display","inline-table");
   }
 });
    </script>
</body>
</html>

Ads









Related Tutorials/Questions & Answers:
Find Browser & it's version using jQuery
Find Browser & it's version using jQuery  Hi sir I heard that JQuery have some method which can be used to find the Browser name & its version. I need the code which checks the browser and if it is "Mozilla", it will show
Using the jQuery Transform plug-in(XSLT)
Using the jQuery Transform plug-in(XSLT)       Using the jQuery Transform plug-in(XSLT... Language Transformations ). The jQuery Plugin we are using
Advertisements
Vertical news slider using jquery
Vertical news slider using jquery  how to creatw vertical news slider using jquery Sorry for wrong category but i cant get my jquery category
Show Limited Data Using jquery
Show Limited Data Using jquery  How to show limited results in JQuery... it using JQuery?   See the JQuery example to show the limited fetch results in JQuery. var comments = $('.description_text').size(); if (comments >
Html form validation using jquery
Html form validation using jquery  Hi i am using form with html. Form elements like textbox, radio,checkbox,listbox i was used now how to validate the elements using submit jquery option
HTML form validation using jquery
HTML form validation using jquery  Is there any way for validating html elements common under a class by giving its class name in jquery validation code..that means validating all elements by using its class name if those
jQuery auto complete through database using JSP shows error
jQuery auto complete through database using JSP shows error  The tutorial on jQuery titled "jQuery auto complete through database using JSP" shows error on browser when I try to select the one in the dropdown. Please help
application using AJAX and JQuery and also use JSP
application using AJAX and JQuery and also use JSP   i need create an application using AJAX and JQuery and also use JSP
Disabling submit button using jQuery
Disabling submit button using jQuery  Hello Sir I want to know - is there any way or approach to disable client side form's "Submit" button. Please give code also.   For all submit buttons, via JQuery, it'd
Using the jQuery event object
Using the jQuery event object       Using the jQuery event object JQuery... to these standards, this system normalize the event object. jQuery. Event
Form validation Using Jquery Plugin
Form validation Using Jquery Plugin  Hello sir I want to implement form validation using JQuery Plug-in. My code is : <html> <style type...;/form> </body> </html> Please provide me JQuery code regarding
How to write a search functionality using javascript/jquery
How to write a search functionality using javascript/jquery   How to write a search functionality using javascript/jquery for ex: im searching "s" names it wil display "s" names
Using the QUnit to test jQuery application
Using the QUnit to test jQuery application       Using the QUnit to test jQuery application Using Qunit , testing of JQuery become very easy and efficient
Show pdf's in web browser by using jsp?
Show pdf's in web browser by using jsp?  Hi, I want to display pdf file in browser by clicking the link, available in JSP page. When am trying to do this by using Anchor tag with absolute path, it is showing the error as: Http
Crop image Using JQuery, servlet or JSP.
Crop image Using JQuery, servlet or JSP.  Hi sir I need the code of Cropping image using JQuery with the help of servlet or JSP. I need both the code Client side as well as of server side. Please Help me
Implementing Digits restriction Using JQuery
Implementing Digits restriction Using JQuery  Hi Sir I have following field in my html form : <div>Age<input type="text" name="quantity.... Please provide code.   You can implement these two things using ASCII code
opening new browser with new JSESSIONID using java
opening new browser with new JSESSIONID using java  I am facing following problem, I am trying to open a new browser using java. First i have opened one IE browser and manually. And i ran my LaunchURL.java file, it is opening new
check username availability using JSP & JQuery
check username availability using JSP & JQuery  Hi sir I want check username availability using JSP & JQuery. Please add code with your answer. Thnks in advance
jQuery Demos
up on hover using jQuery plug in "jQuery. browser " utility... are providing the demo examples of jQuery that you can run in your browser... in different file Display current time using jQuery & JSP
Auto grow Text Area using jQuery plug-in
Auto grow Text Area using jQuery plug-in  Hi sir How can we make a textarea auto grow ? What is the name of the plug-in used for auto grow text area. Please mention code with your reply
how to print HTML using javascript or Jquery
how to print HTML using javascript or Jquery  is there any way to print a document(created using Html and javascript) without using window.print, which works for all the browser specially chrome and firefox, I have used
What is jQuery?
What is jQuery? jQuery is a multi-browser JavaScript library that makes... applications. Till date jQuery v 2.0.0 is the latest version being used. Earlier... and develops web pages that are compatible to most of the browser. jQuery
how to validate the telephone number without using jquery in html with javascript
how to validate the telephone number without using jquery in html with javascript  how to validate the telephone number without using jquery in html with javascript
JQuery
using url of the doctors, use jquery autocomplete...JQuery  my requirement is: as i have a list of doctors in my table in the DB. a textbox is there in the browser it should display all the doctors
Closing any kind of browser window without confirmation using javascript
Closing any kind of browser window without confirmation using javascript  Here is my requirement, I have to close a browser window on onload event... version. Presently am using IE8. Thanks, Suresh
select value from autocomplete textbox using jquery in jsp from database.
select value from autocomplete textbox using jquery in jsp from database. ... but was unable to find out exact way to fullfill the solution of selecting value from autocomplete textbox using jquery in jsp from mysql database. Kindly send me
select value from autocomplete textbox using jquery in jsp from database.
select value from autocomplete textbox using jquery in jsp from database... the tutorials but was unable to find out exact way to fullfill the solution of selecting value from autocomplete textbox using jquery in jsp from mysql database
How to Collapse Dropdowns on mouseclick on scrollbar in Safari Browser using javascript
How to Collapse Dropdowns on mouseclick on scrollbar in Safari Browser using javascript  How to Collapse Dropdowns on mouseclick on scrollbar in Safari Browser using javascript
jQuery Load Content
jQuery Load Content       In this section you will learn how to load content of a text file using jQuery and show it on the use browser. This example shows you how to load the content
find a substring by using I/O package
find a substring by using I/O package  Write a java program to find a sub string from given string by using I/O package
JQuery
JQuery  my requirement is: as i have a list of doctors in my table in the DB. a textbox is there in the browser it should display all the doctors..., use jquery autocomplete

Ads