Skip to content

Instantly share code, notes, and snippets.

@peponi
Created January 13, 2016 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peponi/bd45120c836c835c0634 to your computer and use it in GitHub Desktop.
Save peponi/bd45120c836c835c0634 to your computer and use it in GitHub Desktop.
detect android stock browser. Adds class "is-android-stock-browser" to the html element. You will need this only in rare cases. For example: text-rendering bug with webfonts in Android 4.x.
(function(){
/*
Use this only if really really necessary.
This plugin tries to detect android stock browser.
Place it in the head tag. And after Modernizr.
https://developer.chrome.com/multidevice/user-agent#webview_user_agent
*/
var ua = navigator.userAgent,
reg = /(Version\/\d\.\d)/i;
if(ua.indexOf('Android') > -1 && ua.match(reg) !== null){
// you're most likely on a android stock browser
document.documentElement.className += ' is-android-stock-browser';
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment