LoginSignup
0
0

More than 1 year has passed since last update.

Navigator.maxTouchPointsプロパティのサンプルコードで見かけるmsMaxTouchPoints

Posted at

NavigatorインターフェイスのmaxTouchPointsプロパティの使い方をググると、サンプルコードでmaxTouchPointsと共にmsMaxTouchPointsというプロパティの値も併せてチェックしているスニペットを載せた記事を見かけます。
例)
https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent
https://stackoverflow.com/questions/24121433/detect-if-touch-device-with-ie11-using-javascript/24121527

IE絡みっぽいですが、今も必要なのかわからなかったので、旧バージョンに遡って確認してみました。
テストに使ったコードはこちら: https://codepen.io/kaz_hashimoto/pen/wvmBOMv
これは、問題のプロパティがundefinedになるかどうか、読み取った値は何かを画面に表示します。

BrowserStackを使ってIE11, IE10, IE9で実行した結果はこれです。
result.png

msMaxTouchPointsはIE10で導入され、IE11ではmaxTouchPointsもサポートしたことがわかりました。
msMaxTouchPointsは最新のEdgeでもundefinedですし、もう考慮する必要はないですね。

参考記事
タッチスクリーンであるかを JavaScript で判定する

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0