Skip to content

Instantly share code, notes, and snippets.

@thombashi
Created March 31, 2017 15:34
Show Gist options
  • Save thombashi/c6c8931d79551b4e223ae852e84cc98c to your computer and use it in GitHub Desktop.
Save thombashi/c6c8931d79551b4e223ae852e84cc98c to your computer and use it in GitHub Desktop.
Javascript: Detect browser
<!doctype html>
<html>
<body>
<script>
const isChrome = navigator.userAgent.toLowerCase().indexOf("chrome") !== -1;
const isFirefox = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1;
console.log(`isChrome: ${isChrome}`);
console.log(`isFirefox: ${isFirefox}`);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment