Created
February 17, 2015 19:44
-
-
Save alastaircoote/f3a77d946e7e5df2ebaf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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