ie10-viewport-bug-workaround.js 694 B

1234567891011121314151617181920212223
  1. /*!
  2. * IE10 viewport hack for Surface/desktop Windows 8 bug
  3. * Copyright 2014 Twitter, Inc.
  4. * Licensed under the Creative Commons Attribution 3.0 Unported License. For
  5. * details, see http://creativecommons.org/licenses/by/3.0/.
  6. */
  7. // See the Getting Started docs for more information:
  8. // http://getbootstrap.com/getting-started/#support-ie10-width
  9. (function () {
  10. 'use strict';
  11. if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
  12. var msViewportStyle = document.createElement('style')
  13. msViewportStyle.appendChild(
  14. document.createTextNode(
  15. '@-ms-viewport{width:auto!important}'
  16. )
  17. )
  18. document.querySelector('head').appendChild(msViewportStyle)
  19. }
  20. })();