Skip to content

Instantly share code, notes, and snippets.

@nsorosac
Last active February 15, 2016 07:18
Show Gist options
  • Save nsorosac/a4311e5501987bbb1d09 to your computer and use it in GitHub Desktop.
Save nsorosac/a4311e5501987bbb1d09 to your computer and use it in GitHub Desktop.
Hi-DPI devices viewport
// <HiDPI_viewport_compatibility>
if (typeof window.devicePixelRatio != 'undefined') {
var scale = 1 / (window.devicePixelRatio || 1);
if (scale != 1) {
document.querySelector('meta[name="viewport"]').setAttribute('content',
'width=device-width, initial-scale=' + scale + ', minimum-scale=' + scale);
}
}
// </HiDPI_viewport_compatibility>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment