Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ブラウザ固有のJavaScriptコードを作成するにはどうすればよいですか? たとえば、Firefoxでコードを機能させるため、またはjavascriptを使用するためです。
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x; if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ //test for Firefox
ここでもっと詳しく読む
通常、ブラウザではなく機能を検出する方がよいことに注意してください。エンド ユーザーが使用しているブラウザが自分の機能をサポートしている限り、どのブラウザを使用しているかは気にする必要がないからです。