Switch to full style
JQuery Examples
Post a reply

Get the client navigator browser type or operating system

Thu Jan 17, 2013 9:02 pm

Get the client navigator's browser type or operating system , you can know if it is Mozilla Firefox or IE , Windows NT or IPad , or IPhone , Android... etc.
javascript code
<html>
<head>
<title>Get the type of browser or device visiting your website</title>

<!--
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
Note you can download the JQuery package instead of using Google version. -->
<script src="jquery-1.8.3.js"></script>
<script>
jQuery(document).ready(function($){
var deviceAgent = navigator.userAgent.toLowerCase();
var agentID="";

if (deviceAgent) {
$("#agent").html(deviceAgent);
agentID = deviceAgent.match(/(mozilla)/);
if(agentID) {
$("#agent").append('<br/><u>do something for this firefox</u>');
}

// Check if client is a Iphone,ipod,ipad
agentID = deviceAgent.match(/(iphone|ipod|ipad)/);
if(agentID) {
$("#agent").append('Handle mobile events');
}

}
});
</script>

</head>
<body>
<b> Get the type of brower ( Client Agent ), current client: </b>
<p id="agent">
</p>

</body>

</html>




Re: Get the client navigator browser type or operating system

Fri Jan 18, 2013 1:38 pm

thank you so much

Post a reply
  Related Posts  to : Get the client navigator browser type or operating system
 The operating system using PHP     -  
 $.browser Check if your browser is IE or FireFox or Chrome     -  
 client server client     -  
 Browser     -  
 how can we get browser information in jsp?     -  
 Browser Support     -  
 Whats your favourite browser?     -  
 AJAX - Browser support     -  
 Video Archive Browser in java     -  
 Java Web Browser (Mini Project)     -  

Topic Tags

JQuery Basics