Total members 11890 |It is currently Thu Apr 25, 2024 6:57 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





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>




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time

thank you so much



Author:
Newbie
User avatar Posts: 1
Have thanks: 0 time
Post new topic Reply to topic  [ 2 posts ] 

  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     -  
 Browser Support     -  
 how can we get browser information in jsp?     -  
 Whats your favourite browser?     -  
 AJAX - Browser support     -  
 Video Archive Browser in java     -  
 Java Web Browser (Mini Project)     -  



Topic Tags

JQuery Basics
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com