javascript - Is there any way to detect if user has launched microsoft edge tablet or desktop browser? -
microsoft edge browser returning same user agent both windows 10 tablet , desktop. please me in differentiating micosoft edge tablet , desktop browsers through javascript features or useragent detection or other way.
note: differentiate tablet , desktop browsers pointer events. tablet supports pointer events while desktop doesnt support. in windows 10 desktop supporting pointer events
unlike windows 8/8.1 there 1 microsoft edge browser, rather “immersive” touch friendly browser , regular desktop win32 app. such can’t detect difference ua string, there no difference.
however, if use-case give touch friendly layout touch devices (tablets , convertibles, 2-in-1s, etc) , more compact layout mouse , keyboard users, can use feature detection in css this.
for can use css media queries interaction media features.
if want detect there touch screen:
@media (pointer: coarse) { ...styles touch screen... }
if want detect user can’t hover (a common issue on touch screens):
@media (hover: none) { ... styles ... }
it important point out reports primary pointing device. in machines such convertibles there can trackpad/mouse , touch screen, may report values touch screen.
see the spec details.
Comments
Post a Comment