![]() | |
![]() |
| | Thread Tools | Display Modes |
#11
| ||||||
| ||||||
|
|
You won't be jailed, but it seriously harms both your insight |
|
and our sympathy if you don't. |
|
I have also heard that no scripter really knows what he/she is doing. What do you think about that? No one can speak but for themselves, especially if they spend their time behind computer screens. I for one haven't a clue. |
|
The bottom line is the navigator agent string thing can be changed at will both by browser-makers and end-users. Mine is a Shakespeare quote. |
|
If I want my script to bark up the document.images tree, I will not test for document.styleSheets or screen.availWidth or navigator.anyThing. |
|
Regards, Ivo |
#12
| |||
| |||
|
|
Not to mention credibility. He multi-posted these same thoughts in the microsoft.public.scripting.jscript NG snip |
|
You too? |
#13
| ||||
| ||||
|
|
Isn't it still a fact that most script that goes around is not cross-browser? |
|
I have also heard that no scripter really knows what he/she is doing. What do you think about that? |
|
2. I don't want to build a detector every time depending on what I want to use. |
|
3. A generic feature based browser detector seems to be much more work than the one I posted. If you build one let me know and I will give it a try. |
#14
| |||
| |||
|
|
So you haven't bothered to read the comp.lang.javascript FAQ before posting then:- URL: http://jibbering.com/faq/#FAQ4_26 I do not need to read the FAQ before or after I post. |
#15
| ||||
| ||||
|
|
I have also heard that no scripter really knows what he/she is doing. What do you think about that? I think that sounds like flame bait. I think that if you believe that, then you just insulted yourself. I think you need better sources of information. I think that if you stick around the newsgroup for a while you will discover that statement is wrong. |
|
Yeah, if you want to test whether the browser is capable of doing, say, image rollovers, writing var fSupportsScriptableImages = (document.images ? true : false); sure is a real pain. |
|
No one would ever write a "generic feature based browser detector". Whatever that is. |
|
This isn't an argument you'll win; feature/object detection has long been recommended over browser detection. |
#16
| |||
| |||
|
|
It would, however, be a useful precaution against appearing to be a person of inadequate sagacity. Of course, that appearance would in that case not be misleading. |
#17
| ||||||||||||
| ||||||||||||
|
|
So you haven't bothered to read the comp.lang.javascript FAQ before posting then:- URL: http://jibbering.com/faq/#FAQ4_26 I do not need to read the FAQ before or after I post. - as it says essentially the same thing. (Still, I don't expect you would consider that a document that is subject the scrutiny and review of all of the regular poster to this group as having anything accurate to say on the subject of browser scripting.) I don't know what to answer to you as I have not read the FAQ. |
|
Isn't it still a fact that most script that goes around is not cross-browser? |
|
I have also heard that no scripter really knows what he/she is doing. What do you think about that? |
|
A detector is about "what is" not about "what ought to be". So test "what is" not "what ought to be" which is what you are testing by assuming that the navigator.userAgent string ought to be a discriminating indicator of the type and version of a web browser. It is not and has not been for quite some time now. One can easily write a lynx-like user agent that supplies any user string he/she damn pleases. |
|
Why does that shatter the status of things? (The status being that all major browsers have - and should have - distinctive default strings) |
|
As it is your code will identify Konqueror 3 as IE, Netscape, Opera Konqueror and unknown depending on which of the userAgent string I choose form the list of 20 odd provided in the drop-down in the preferences. Well, if you change the string you are on your own. |
|
While the same script will be absolutely convinced that my Palm OS web browser is IE 6, but a script that treats it as IE 6 will fail horribly. To qualify as a "detector" a script should be expected to produce discriminating results. The navigator.userAgent string just cannot provide that. Only because you were naughty and you changed the string. |
|
What is the motivation in coding for the miniscule percentage of users who not only use virtually non-existent browsers but also play with their user agent strings? |
|
But, as I said, it is almost never necessary to know the browser type or version. Feature detection ... snip |
|
1. Detecting a browser type is not necessarily for scripting purposes. For instance, you may not like the way something renders in gecko. |
|
2. I don't want to build a detector every time depending on what I want to use. |
|
3. A generic feature based browser detector seems to be much more work than the one I posted. If you build one let me know and I will give it a try. |
#18
| |||||||||||||
| |||||||||||||
|
|
You could try to explain why you "do not need to read the FAQ". |
|
It certainly isn't because you are already familiar with its contents, or that you know JavaScript and browser scripting better than its collective authors (though it may be because you believe one, or both, of those to be the case). |
|
snip Isn't it still a fact that most script that goes around is not cross-browser? Yes, it is also a fact that some scripts do not even manage to be multi-browser (which is all that your scripting actually aspires to be, judging by your other posts in this thread). |
|
True cross-browser scripting; authoring for any and every browser, including the ones that will not execute JavaScript at all. And the only strategy that is capable of delivering scripts that function, or gracefully degrade (as appropriate), in JavaScript enabled browsers is feature detecting to determine browser support for the features required by the script. |
|
I have also heard that no scripter really knows what he/she is doing. What do you think about that? If you did hear that it will have been from the lips of someone who did not know what they were doing and was looking to justify their unwillingness to find out. |
|
Of what value is it that some browsers have default user agent string that are distinct from each other when they are indistinguishable from the user agent strings of a cluster of other browsers? Of what value is it when those strings are only the default values and the user has easy access to mechanisms for changing them; mechanisms that (usually) have zero impact on the actual abilities of the browser? And why "should have"? Because it suites you? |
|
The status of things is that the navigator.userAgent string is no longer a discriminating identifier of web browsers and, if it ever was, it never will be again. |
|
Web browsers are user configurable software. If the user has the options in the software preferences then it is just unrealistic not to expect them to configure their browser to reflect their preferences. In all of the web site/application specifications I have seen to date I have seen requirements to work with only a limited set of named browsers/versions and even requirements to work only with JavaScript enabled browsers but I have never seen it stated that scripts were only required to work with those browsers in their _default_ configurations. |
|
Of course your "browser detecting" followed by the assumption that everything is then going to be the way that you are expecting it is going to fall down with many non-default configurations even on IE. |
|
No I did not. Pals OS web browser is just one of a number of browsers that use a user agent string that is indistinguishable from an IE user agent string, and it doesn't give the user any direct access to alternatives. And indistinguishable means indistinguishable, there is no telling substring that can be used to distinguish them from IE versions (on the Palm even the reported OS is fictional). |
|
(assuming of course that these browsers that are indistinguishable from IE are actually minority browsers. It is impossible to tell if they always appear in the browser statistics as IE). |
|
1. Detecting a browser type is not necessarily for scripting purposes. For instance, you may not like the way something renders in gecko. Rendering is presentation, so CSS. Use CSS solutions for CSS problems, |
|
You are still thinking in terms of browser detecting. Feature detecting is an integral part of scripting; there is no distinct "detector" at all. |
#19
| |||||||
| |||||||
|
|
Yes, it is also a fact that some scripts do not even manage to be multi-browser (which is all that your scripting actually aspires to be, judging by your other posts in this thread). Well, the scripts that I have posted are certainly multi-browser so what you say here is obviously wrong. |
|
Have you ever wondered why the user agent string is there at all? Why was it introduced and kept in countless versions and builds? .... User-Agent = "User-Agent" ":" 1*( product | comment ) Example: User-Agent: CERN-LineMode/2.15 libwww/2.17b3 ---- After all the computer world only revolves because there are standards that are followed by majorities. |
|
The status of things is that the navigator.userAgent string is no longer a discriminating identifier of web browsers and, if it ever was, it never will be again. The point is that it should be. |
|
On the other hand perhaps your faith that object/property testing will remain a good way to test is overly inflated. |
|
You are not supposed to fake user agent strings. Period. |
|
This feature has only become available in various browsers and only because it is very easily implementable. |
|
* Should every browser preferably have a distinctive user agent string or not? Don't read the RFC just use your common sense. |
#20
| |||||||||||
| |||||||||||
|
|
Well, the scripts that I have posted are certainly multi-browser so what you say here is obviously wrong. Uhm, no. He said that it is multi-browser, but not cross-browser, so you agree with him. |
|
It is *not* followed by the majorities. Internet Explorer doesn't follow it! IE claims to be Mozilla/4.0 and then adds a comment saying that it is really (Compatible; MSIE 6,0;...). |
|
Every time someone makes a page that restricts access to some browsers, most likely including IE, a browser will change, or allow the user to change, how it identifiers itself. It does that, not because it doesn't care about the standard, but because it has to work in a world where page authors force them to lie. |
|
The point is also that browser detection shouldn't be necessary. |
|
But it isn't. Browsers should support standards, but the most widely used browser doesn't understand proper CSS 2 and doesn't follow the W3C DOM specifications. |
|
On the other hand perhaps your faith that object/property testing will remain a good way to test is overly inflated. Care to explain why? |

|
You are not supposed to fake user agent strings. Period. You are not supposed to restrict access to a page based on the browser. That is counter to the very basic concept of the web. But they do, and browsers adapt. |
|
It is sad that faking your user agent string is necessary, but blame the page authors, not the browser vendors or users. They started it. |
|
This feature has only become available in various browsers and only because it is very easily implementable. And not because there was a need? Do you really mean that? |
|
* Should every browser preferably have a distinctive user agent string or not? Don't read the RFC just use your common sense. They should. Do they? No. Your code is meant to solve a real life problem: That browsers are different. In an ideal world, your program is not necessary. In the real world, it should consider the real life problem that the user agent string can not be trusted in all cases. |
|
I do know that your program would have problems with detecting Netscape 4, since it identifies itself as Mozilla/4 , and so does IE. |
![]() |
| Thread Tools | |
| Display Modes | |
| |