Minimal JavaScript Browser Fingerprinting
If you, like me, enjoy pointless JavaScript challenges, then this is your place.
The task is to write a Javascript function that returns the current Browser name.
You need to support at least Chrome, Firefox, Safari and IE.
The Rules
- The JavaScript expression needs to return the strings 'Chrome', 'Safari', 'Firefox' or 'IE' in the respective browsers.
- More explicitly, we are using the following browsers to confirm and expect these outcomes:
- Firefox 49 should return the string "Firefox".
- Edge 38.x (EdgeHTML 14.x) on Windows 10 should say "IE" (Updated rules!)
- Chrome 53 (expecting 'Chrome')
- Safari 9 on Mac OS X 10.11 should say 'Safari'
- It needs to support at least those 4 browsers.
- Honorable mention if it supports more browsers.
- It needs to run in any kind of JavaScript context that has a window.
- Bonus points if it does all that in
Worker
environments.
- The shortest expression wins
Submissions
- Yours truly, @freddyb with 83 characters (October 13th)
- You?
Please send your submission to fbraun@mozilla.com or message to @freddyb on twitter.