Skip to content

Instantly share code, notes, and snippets.

@luckyshot
Last active December 16, 2015 02:59
Show Gist options
  • Save luckyshot/5366726 to your computer and use it in GitHub Desktop.
Save luckyshot/5366726 to your computer and use it in GitHub Desktop.
Browser and client details in JavaScript
/****************************************************
* Website
****************************************************/
// Page title
document.title.substring(0, 200);
// Domain (i.e. gist.github.com)
document.domain;
// Returns object with host, path, protocol, port, hash...
document.location
// Referrer
document.referrer;
/****************************************************
* System
****************************************************/
// Returns object with UA, lang, platform, vendor... if undefined then call as 'window.navigator'
navigator;
// OS (i.e. MacIntel)
navigator.platform
// User Agent
navigator.userAgent;
// User language (i.e. en-US)
navigator.userLanguage || navigator.language;
/****************************************************
* Dimensions
****************************************************/
// Browser window dimensions
document.body.offsetHeight
document.body.offsetWidth
// Browser viewport dimensions
window.innerHeight
window.innerWidth
// Computer screen dimensions and color depth
screen.height
screen.width
screen.colorDepth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment