Browser Detection Fail

This is what we call Learning By Making Mistakes. I think.

I found a free little hosting site and am writing my first tiny little scripts that will, hopefully, sprout up into glorious and magnificent scripts and apps. Here’s my first attempt and the result:


I want that second paragraph to inform the user which browser they’re using and what OS.

I am so not using Netscape and am most definitely not using Windows NT so I immediately thought either the script was stupid or I was. I Googled, as you do, and found that IE11+ returns “Netscape” for the value of appName. Well, either IE is stupid (grin) or the Script is. I’ve wondered what Win32 was whenever I’ve seen it and it seems to simply be an obsolete and useless file.

Moral of the story: The results of line 12 of my code is a total fail. Sure, maybe it did its job, but I need that line to give the user something useful. Back to the drawing board.

I’ve seen two references to using Object Detection instead. Hopefully, that spits out something understandable and useful.


About jotascript

Aiming to please. Seeking to impress.
This entry was posted in JavaScript, Learning and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s