Can you detect "Tablet Mode" in Edge and IE11 using JavaScript in Windows 10?

I’m thinking about my user interface dynamically changing to a more user-friendly layout when the user switches to “Tablet mode” and switches back to our “desktop” if they turned off the Tablet mode.

This requires (1) detecting tablet mode in JavaScript (2) detecting tablet mode change on / off.

I prefer pure JavaScript and the DOM (not jQuery, Modernizr, etc.).

Cause. We have a high-density user interface (on the desktop) that we simply cannot just change. I want to add an interval so that it is more contact-friendly in tablet mode. This is the same as the Windows 10 taskbar adding an extra padding between the icons in Tablet mode (presumably, other Windows 10 apps will act this way?)

Edit: I did some research in the viewing area, since it seems like a scrollbar with zero width is a trick for detecting the Tablet Mode (or Metro) mode. http://pastebin.com/ExPX7JgL

+4
source share
2

: 0 Edge. : Edge.

JavaScript .

Edge (IE12) Windows 10, Internet Explorer 11. , ( , , . , - , 100% ).

, (iOS, Android, Windows Phone, Safari OSX -ms-overflow-style: none, ). Modernizr 3 hiddenscrollbar, , .

+3

.
Windows 10 , .

.

W3C, //. , , .
( Firefox/Opera/IE Chrome)

+1

Source: https://habr.com/ru/post/1606696/


All Articles