background preloader


Facebook Twitter

Browser detect. A useful but often overrated JavaScript function is the browser detect. Sometimes you want to give specific instructions or load a new page in case the viewer uses, for instance, Safari. If you're new to JavaScript, don't use browser detects. You don’t need them. Please read the object detection page first.

This page used to contain my own browser detect script, but I found that I do not have enough time to keep it up to date. I advise you to use WhichBrowser. If you use my old script I advise you to switch to WhichBrowser. Below you see the objects contained by the object navigator. 用 js 或 php 判斷 Android 手機上網. jQuery 偵測瀏覽器版本, 作業系統(OS detection) jQuery browser and OS detection plugin. Browser/OS detection with jQuery As I wrote in my recent post I simply use the PPK BrowserDetect object to find out the browser/OS of the client. Actually I’m pretty sure there’s a similar jQuery plugin based again on that code from, but however I decided to write a simple plugin for jQuery wrapping it into a closure and exporting it in the “$” object.

Demo You can see full working example here. Installation You must add a link to jquery.client.js after the jquery.js file in your code: Now there’s a $.client object containing two strings with OS and browser, they can be referenced with: You can append this code after you jquery.js installation. Download You can download the sample code from here.