Skip to content

Instantly share code, notes, and snippets.

@uhtred
Forked from alastaircoote/webviewprovider.js
Last active August 29, 2015 14:15
Show Gist options
  • Save uhtred/46a4d8a4ac0c9f614ad8 to your computer and use it in GitHub Desktop.
Save uhtred/46a4d8a4ac0c9f614ad8 to your computer and use it in GitHub Desktop.
var webviewProvider = (function() {
if (/\/FBIOS/i.test(navigator.userAgent) === true) {
return 'facebook';
}
if (/Twitter for/i.test(navigator.userAgent) === true) {
return 'twitter';
}
if (/Pinterest\//.test(navigator.userAgent) === true) {
return 'pinterest';
}
if (/\/\/t.co\//i.test(document.referrer) === true && /Safari\//.test(navigator.userAgent) === false) {
return 'twitter';
}
if (/tumblr.com\//i.test(document.referrer) === true && /Safari\//.test(navigator.userAgent) === false) {
return 'tumblr';
}
return null;
})();
if (webviewProvider !== null) {
document.body.classList.add(webviewProvider);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment