Archive Pages Design$type=blogging

How to Detect Visitor's Browser Using JavaScript?

You can detect which and what version of browser have used by your website visitors by using simple JavaScript codes. The navigator object i...


How to Detect Visitor's Browser Using JavascriptYou can detect which and what version of browser have used by your website visitors by using simple JavaScript codes. The navigator object in JavaScript contains information about the visitor's browser. It includes information about the visitor's browser name, browser version and more. It can be very useful to detect the visitor's browser type and version, and then serve up the appropriate information. By using this feature in JavaScript, it is easier to make your web pages smart enough to look one way to some browsers and another way to other browsers. But it may not be work for some browsers, specially for older browsers, which do not support JavaScript.

Here are some steps and codes for detecting visitor's browser using JavaScript, it may help you to apply this feature in your website.



Code for Detecting Visitor's Browser and Browser Version Using JavaScript


<script type="text/javascript">
var x=navigator

document.write("Name=" + x.appName)
document.write("<br/>")
document.write("Version=" + x.appVersion)
document.write("<br/>")
document.write("CookieEnabled=" + x.cookieEnabled)
document.write("<br/>")
document.write("BrowserLanguage=" + x.browserLanguage)
document.write("<br/>")
document.write("SystemLanguage=" + x.systemLanguage)
document.write("<br/>")
document.write("UserLanguage=" + x.userLanguage)
</script>

Where: 

  • appName - It holds the application name of the browser.
  • appVersion - It holds the version of the application and other things.
  • cookieEnabled - It checks whether or not cookie is enabled.
  • browserLanguage - It holds the browser Language.
  • systemLanguage - It holds the system Language.
  • userLanguage - It holds the user Language.



Output of the Code for Detecting Visitor's Browser and Browser Version 





Example: Alert user for older browser



You can alert or inform the visitor of  your website by using navigator object in JavaScript as the following. Here in the given code, the browsers below the version 4 are treated as older browser and displays the message. You can also add the links to download the latest version of browsers. 

<script type="text/javascript">

var browser= x.appName
var version = parseFloat(x.appVersion)

if((browser="Netscape" || browser=="Microsoft Internet Explorer") && (version>=4))

{document.write("Your browser is good enough!")
document.write("<br/>")}

else
{document.write("Your browser is old Update browser!")
document.write("<br/>")}

</script>

Output of the above Code  





Related Posts

تعليقات

الاسم

Artificial Intelligence(AI) Backlinking Basic IT Best List Blogging Tips C C# C++ Computer Architecture Computer Fundamental Computer Security Computer/IT Officer Exam CSS Data Mining and Warehousing Data Recovery Tools Data Structure Database Management System E-commerce E-government Internet & Web Designing IT Law IT Tips and Tricks IT Tutorials Java JavaScript Keyword Research Tools MIS Multiple Choice Question (MCQ) Networking Online Earning Online IT Jobs Operating System Oracle Forms and Reports Programming Guide Programming Language SEO Social Networking Sites Software Download Software Engineering System Analysis and Design Top List VB.Net
false
rtl
item
Max5: How to Detect Visitor's Browser Using JavaScript?
How to Detect Visitor's Browser Using JavaScript?
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNTL41NVe3WM2nI7DL4xObym-Dpa4w84vz_-9ap5dgekb12K0dAAYQJofbd8pvBgfvkU67nlC1AItSuUzF3D6qeZ2y3z13QEPzEG0NB9DAO_1dt_03MO7Y3-kbu2n6_esN3w2ufJh7TynN/s1600/browserdection.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNTL41NVe3WM2nI7DL4xObym-Dpa4w84vz_-9ap5dgekb12K0dAAYQJofbd8pvBgfvkU67nlC1AItSuUzF3D6qeZ2y3z13QEPzEG0NB9DAO_1dt_03MO7Y3-kbu2n6_esN3w2ufJh7TynN/s72-c/browserdection.png
Max5
https://maxs27.blogspot.com/2014/02/how-to-detect-visitor-browser-using.html
https://maxs27.blogspot.com/
http://maxs27.blogspot.com/
http://maxs27.blogspot.com/2014/02/how-to-detect-visitor-browser-using.html
true
1760660989564394152
UTF-8
لم يتم العثور على اى مواضيع شاهد الكل اقرأ المزيد رد احذف الرد حذف بواسطة الرئيسية صفحات مواضيع شاهد الكل نوصى لك التسميات الارشيف بحث لم يتم العثور على ماتبحث عنه عودة للرئيسية الاحد الاثنين الثلاثاء الاربعاء الخميس الجمعة السبت الاحد الاثنين الثلاثاء الاربعاء الخميس الجمعة السبت يناير فبراير مارس ابريل مايو يونيو يوليو اغسطس سبتمبر اكتوبر نوفمبر ديسمبر يناير فبراير مارس ابريل مايو يونيو يوليو اغسطس سبتمبر اكتوبر نوفمبر ديسمبر just now 1 دقيقة مضت $$1$$ دقيقة مضت 1 hour ago $$1$$ ساعة مضت الامس $$1$$ يوم مضى $$1$$ اسبوع مضى اكثر من 5 اسابيع مضت