Skip to content

Instantly share code, notes, and snippets.

@eltiare
Created August 16, 2013 17:20
Show Gist options
  • Save eltiare/6251755 to your computer and use it in GitHub Desktop.
Save eltiare/6251755 to your computer and use it in GitHub Desktop.
Shameless stolen from here: http://stackoverflow.com/questions/15687276/pixels-in-css-vs-pixel-density This is used to account for various DPI differences in mobile devices for web pages. Put this in a script tag or a *.js file and include it in your document.
(function() {
var meta = document.createElement("meta");
meta.setAttribute('name','viewport');
meta.setAttribute('content', 'initial-scale=' + (1 / window.devicePixelRatio) + ',user-scalable=no');
document.getElementsByTagName('head')[0].appendChild(meta);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment