1. INCLUDE JS FILES
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/pgwbrowse.js"></script>
2. JAVASCRIPT
var pgwBrowser = $.pgwBrowser();
print_r(pgwBrowser);
Plugin return
PgwBrowser returns an object with four objects within:
"userAgent" - Returns the visitor's user-agent. For example:
[...]
userAgent : "Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0"
[...]
"browser" - Returns the visitor's browser details. For example:
[...]
browser : {
"name": "Firefox",
"group": "Firefox",
"fullVersion": "31.0",
"majorVersion": 31,
"minorVersion": 0
}
[...]
- Name: The browser name (see all possibilities below).
- Group: The group name of the browser (see all possibilities below).
- Full version: The full version number, for example: "31.0" or "36.0.1985.125".
- Major version: The major version number, for example with the version "31.0": the number "31".
- Minor version: The minor version number, for example with the version "31.0": the number "0".
Group name |
Browser names |
"Chrome" |
"Chrome", "Chrome Mobile", "Chrome for iOS", "Chromium", "Android Browser" |
"Firefox" |
"Firefox" |
"Explorer" |
"Internet Explorer", "IEMobile" |
"Opera" |
"Opera", "Opera Mini" |
"Safari" |
"Safari" |
"viewport" - Returns the visitor's window details. For example:
[...]
viewport": {
"width": 1903,
"height": 969,
"orientation": "landscape"
}
[...]
- Width: The width of the window in pixels.
- Height: The height of the window in pixels.
- Orientation: The orientation type of the window: "portrait" or "landscape".
"os" - Returns the visitor's platform details. For example:
[...]
os : {
"name": "Windows 8.1",
"group": "Windows",
"fullVersion": "8.1",
"majorVersion": 8,
"minorVersion": 1
}
[...]
- Name: The name of the operating system (see all possibilities below).
- Group: The group name of the OS (see all possibilities below).
- Full version: The full version number, for example: "8.1" or "10.9.3".
- Major version: The major version number, for example with the version "8.1": the number "8".
- Minor version: The minor version number, for example with the version "8.1": the number "1".
Group name |
Platform names |
"Windows" |
"Windows 2000", "Windows XP", "Windows Vista", "Windows 7", "Windows 8", "Windows 8.1", "Windows" (the last one is used only when no other element has been matched) |
"Windows Phone" |
"Windows Phone" |
"Chrome OS" |
"Chrome OS" |
"Android" |
"Android" |
"iOS" |
"iPhone", "iPad", "iPod" |
"Mac OS" |
"Mac OS X Cheetah", "Mac OS X Puma", "Mac OS X Jaguar", "Mac OS X Panther", "Mac OS X Tiger", "Mac OS X Leopard", "Mac OS X Snow Leopard", "Mac OS X Lion", "Mac OS X Mountain Lion", "Mac OS X Mavericks", "Mac OS" (the last one is used only when no other element has been matched) |
"Linux" |
"Ubuntu", "Debian", "Gentoo", "Linux" (the last one is used only when no other element has been matched) |
"BlackBerry" |
"BlackBerry" |
Plugin events
PgwBrowser::StartResizing - This event is launched when the resizing starts.
$(document).bind('PgwBrowser::StartResizing', function() {
// Your code when the resizing starts.
});
PgwBrowser::StopResizing - This event is launched when the resizing stops.
$(document).bind('PgwBrowser::StopResizing', function() {
// Your code when the resizing stops.
});
PgwBrowser::OrientationChange - This event is launched when the orientation changes.
$(document).bind('PgwBrowser::OrientationChange', function() {
// Your code when the orientation changes.
});