I disagree with your assessment, but it isn't a big deal with me. Screen resolution is easy to detect, browsers are a bit trickier.
Virtually all browsers will correctly report these two properties:
screen.width
and:
screen.height
and report them quite literally, so if screen.width is less than or equal to 800:
Code:
if(screen.width<=800)
alert('Use a higher resolution');
or some such thing. Any resolution can be detected and acted upon in this sort of fashion.
When it comes to browsers, they can spoof as other browsers, but a clever script can cut through that (subject to future changes in browser's spoofing abilities, and future changes in the default self reporting of browsers). However, depending upon why you want to know, it is generally better to test if a method or object is available before using it, and then to branch your code accordingly. After all, who cares what the browser is, as long as it can handle the code?
But, if browser type/version sniff you must, this is a good resource:
http://www.howtocreate.co.uk/tutoria...s/sniffer.html
as is:
http://www.quirksmode.org/js/detect.html
Less useful in detecting, but perhaps interesting nonetheless is this page I created:
http://home.comcast.net/~jscheuer1/side/nav_obj/
which iterates the navigator object for virtually any browser. It doesn't detect anything, but it does report what any given browser has set as properties of the navigator object, and what those values are.
I do still stand by my premise though, which (to elaborate) is that you can design a page that will look good (not identically) in about any resolution, and that will function well (not identically) in about any browser with, or without javascript enabled. And that doing so is more professional looking, and perhaps even easier in the long run than trying to make your users change their hardware and/or software settings or equipment, or than is setting up several different versions of your site.
There is more to this issue. For example - the positive responses from folks you have educated. You are not going to hear much from people who found that effort obnoxious, they will just surf elsewhere. And - detecting things with javascript is limited, it excludes folks without javascript enabled. The list goes on and on.
Bookmarks