Last active
April 17, 2022 19:09
-
-
Save stowball/4617428 to your computer and use it in GitHub Desktop.
Microsoft's stop-gap solution to fix IE 10 & 11's viewport on Windows Phone 8. I've also added another condition so it won't run on other browsers that spoof the user agent. Details: http://mattstow.com/responsive-design-in-ie10-on-windows-phone-8.html
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
(function() { | |
if ("-ms-user-select" in document.documentElement.style && navigator.userAgent.match(/IEMobile/)) { | |
var msViewportStyle = document.createElement("style"); | |
msViewportStyle.appendChild( | |
document.createTextNode("@-ms-viewport{width:auto!important}") | |
); | |
document.getElementsByTagName("head")[0].appendChild(msViewportStyle); | |
} | |
})(); |
Lumia Spoofer is the best forever now
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It worths mentioning that this code will not work on "Edge browser - Windows 10 Mobile" since the user-agent is now different:
Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Nokia; Lumia 520) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Mobile Safari/537.36 Edge/13.10570
Needs a little bit of tweaking to make it work.