Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > User Agent Detection Logic

Reply
Thread Tools

User Agent Detection Logic

 
 
kaeli
Guest
Posts: n/a
 
      09-25-2003
In article <3f71f76f$0$213$(E-Mail Removed)>, http://www.velocityreviews.com/forums/(E-Mail Removed)
enlightened us with...
>
> >
> > Haven't you yet learned the futility of trying to have a debate with the
> > mentally challenged?
> > Don't have a battle of wits with an unarmed opponent. It isn't nice.
> >
> > Or are you just playing with him because you're bored? *LOL*

>
> heehee! Kaeli, you are such a cutie! *LOL* ooooxxxx
>
> New agey love,
> F.
> --



*snicker*

smooches!

-------------------------------------------------
~kaeli~
All I ask for is the chance to prove that money
cannot make me happy.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
 
Reply With Quote
 
 
 
 
Richard Cornford
Guest
Posts: n/a
 
      09-25-2003
"Fotios" <(E-Mail Removed)> wrote in message
news:3f729b4d$0$217$(E-Mail Removed)...
>I will not deal with the rest of the stuff that you mention
>(to which I disagree) or the fact that you seem to have
>somehow gotten emotionally involved (sorry if I caused this).


Given your demonstrated shortcomings in extracting literal meaning from
written English I think you would be best advised to concentrate on that
and abandon efforts to interpret emotional overtones until you have that
under your belt. As I recall my emotional response to your last post was
nothing more than slight amusment (at the fact that Steve's predicted
outcome had come to pass).

>I will not even try to get into a theological discussion
>with you (which I don't see how it is not OT - you being
>so sensitive about OT stuff).


It would be OT, but should you consider yourself properly equipped for a
theological discussion if you have not read the Bible?

>I will even hold my ironic remarks to your admission that you
>are an atheist (I don't want you to have a stroke or anything).


I see no irony (or anything unusual) in an atheist being able to
recognise hypocrisy.

<snip>
>Imagine this dear Richard: Let's say I am an open source
>proponent who is sick and tired of Microsoft's marketing
>tricks and the way they undermine public standards. So,
>I build this excellent open source browser which supports
>all W3C DOM objects (in a very proper way) but I also
>choose to attack Microsoft in my own way by faking the
>proprietary Microsoft objects or methods/properties; that
>is they exist but they give erroneous values (like: "Billy
>is a custard face" instead of some other string that is
>expected). Why would I do that? But because this way I
>would break scripts that try to support these objects.
>This would be an angry open sourcer's way of fighting
>back and saying out loud "Scripters! Do not script for
>Microsoft's proprietary objects/methods/properties that
>antagonize and undermine W3C standards". Extreme in a way
>but I think conceivable - in my opinion, not more extreme
>that having Shakespeare quotes as your agent string.


Mozilla already says "Scripters! Do not script for Microsoft's
proprietary DOM" by the simple measure of not implementing very much of
it (though you might break innerHTML just to be comprehensive).

The browser you are describing is not significantly different from the
W3C DOM compliant browsers that fake objects from the Microsoft DOM in
order to avoid being ostracised by scripts that attempt browser
detection by object inference. And feature detecting as a technique
already copes quite happily with those browsers. To the best of my
recollection, as you describe it this browser is going to happily
execute _every_ feature detecting script I have ever written because I
have always favoured using W3C DOM methods over proprietary ones, only
falling back to a proprietary methods if a W3C DOM approach is not
available/functional on the browser.

To significantly impact on the effectiveness of feature detecting as a
technique you would have to pervert the _entire_ browser DOM well beyond
the point at which no existing browser detecting based script could work
on it either. And even then the chances are still good that a feature
detecting script would recognise its inability to execute and be in a
position to degrade cleanly under control, while the browser detection
based scripts (assuming that they were allowed the opportunity to run on
this unrecognised browser) would just error until they failed entirely.

The result would be a browser that could _only_ execute scripts that
were specifically written for its perverse DOM. If making scripting the
browser require specialist knowledge was the goal of the browser authors
then it would be easiest achieved by just switching to a non-standard
scripting language, and if the goal was a browser that would not
successfully execute anyone's scripts then that would be easiest
achieved by just stripping scripting out entirely.

That leaves you as the only person motivated to go down the totally
perverse DOM route. And yes it may demonstrate that feature detecting
scripts cannot cope 100% with anything at all. On the way you have also
killed off all browser detecting scripts, so all that such a browser
would server to demonstrate is that while feature detecting cannot be
100% it is still significantly more robust than browser detecting. I
don't see that as contributing in any way towards an argument in favour
of browser detecting, quite the reverse.

Richard.


 
Reply With Quote
 
 
 
 
Richard Cornford
Guest
Posts: n/a
 
      09-25-2003
"Albert Wagner" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
<snip>
>I note the use of the phrase: "actually necessary." Is
>there some concensus, even among a few, that browser
>detection, of any kind, is not necessary or desirable?


There is complete consensus that browser detecting based on the
navigator.userAgent string cannot uniquely identify individual web
browsers, that is just a truth. There may be approaches based on object
inference that can uniquely identify some (but not all) browsers, but it
would be necessary to have complete details of _all_ browser DOMs in
order to have any confidence in the results, and that is impractical.
The individuals with the widest familiarity with browser DOMs freely
admit that even they do not know enough to implement a truly
discriminating object inference based browser detecting script. And even
if it was done such a script would need to be updated whenever a new
browser was released (world wide).

So if there are circumstances under which it is *necessary* to uniquely
identify a web browsers then the impossibility of doing that becomes an
insurmountable problem.

People do occasionally propose circumstances under which they believe
that they need to identify browsers but these usually turn out to arise
due to a lack of understanding of HTML or CSS and when they are genially
JavaScript problems there is often either an alternative approach that
circumvents the problem or and examination of the logic of the problem
indicates a specific test that will discriminate browsers that have the
problem from those that don't without the need to know which browsers
those are. And, of course, there are a few things that just cannot be
done (or tested) with sufficient reliability to be appropriately used
outside of an Intranet.

There is a very wide consensus (at least among those knowledgeable about
browser scripting) that testing the features specifically required by a
particular script is the only viable technique for cross-browser
scripting, thus side-stepping the fact that browsers cannot be uniquely
identified by never asking that question.

You can judge the support for browser detection by the total number of
people contributing to this thread in support of that approach.

>I am new to JavaScript and am just curious. At this
>point I have doing HTML strict 4.01 on Opera 7.11, with
>no concern for cross-browser compatibility.


Client-side Internet JavaScript is probably unique in computer
programming terms in that it has to be authored with zero certainty
about the environment in which it will be executing. To be effective its
authors have to embrace that fact and adopt a different attitude towards
achieving their goals. But without that challenge cross-browser
scripting would be no more interesting than working with many other
programming languages. I would always recommend aspiring to author
cross-browsers scripts. After all a cross-browser scripter can author
for any specific browsers, the reverse is not true.

Richard.


 
Reply With Quote
 
Fotios
Guest
Posts: n/a
 
      09-25-2003
Jim,

you seem to have comprehension problems.

F.

"Jim Ley" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Thu, 25 Sep 2003 10:42:11 +0100, "Fotios" <(E-Mail Removed)> wrote:
>
>
> > I also choose to
> >attack Microsoft in my own way by faking the proprietary Microsoft

objects
> >or methods/properties; that is they exist but they give erroneous values
> >(like: "Billy is a custard face" instead of some other string that is
> >expected).

>
> Well the script will almost certainly reject your browser when it
> checks for the document object, which doesn't exist in the W3 DOM.
>
> However the object detection technique, will have no problem with
> this, consider document.all.chicken returning your string instead of
> an object, that will fail when you check the chicken object is what
> you expect, or that the chicken.style is indeed an object, your
> intentional spoofing only works if you don't spoof objects, but make
> them do intentionally wrong things (e.g. have a style visibility
> change the colour instead or something) So you'd have to deliberately
> break the objects behaviour not just have them return a string.
>
> However, all of it's academic, as you've implemented the W3 DOM, and
> clj has always advocated checking and using that first, so our scripts
> won't see your mess, just old ones...
>
> >Do not script for
> >Microsoft's proprietary objects/methods/properties that antagonize and
> >undermine W3C standards".

>
> Except of course that doesn't work, because the W3 simply hasn't
> standardised huge gaping holes which are requied to do any scripting,
> de facto standards are required.
>
> Jim.
> --
> comp.lang.javascript FAQ - http://jibbering.com/faq/
>



 
Reply With Quote
 
Lasse Reichstein Nielsen
Guest
Posts: n/a
 
      09-25-2003
"Fotios" <(E-Mail Removed)> writes:

> Anyone who can think straight can see how a browser like the one I have
> described would make the detection style you are a proponent of a big
> problem in many cases.


A browser that implements W3C DOM perfectly[1], but which maliciously
distorts proprietary IE features, will work perfectly with object
detection ... because you should always test for W3C DOM first.

/L
[1] Including widely accepted non-W3C objects that are not originated
at Microsoft, e.g., the global "document" and "window" variables.
--
Lasse Reichstein Nielsen - (E-Mail Removed)
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
 
Reply With Quote
 
Jim Ley
Guest
Posts: n/a
 
      09-25-2003
On Thu, 25 Sep 2003 23:25:17 +0100, "Fotios" <(E-Mail Removed)> wrote:

>> A browser that implements W3C DOM perfectly[1], but which maliciously
>> distorts proprietary IE features, will work perfectly with object
>> detection ... because you should always test for W3C DOM first.

>
>Have you noticed how you are suddenly on a "should" basis?


Well you're the perfect example of how people don't understand object
detection... what other word than SHOULD do you think Lasse should be
using? it can't be MUST, we have no control over people, so what
exactly do you suggest?

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

 
Reply With Quote
 
Jim Ley
Guest
Posts: n/a
 
      09-25-2003
On Thu, 25 Sep 2003 23:48:01 +0100, "Fotios" <(E-Mail Removed)> wrote:

>
>
>> Well you're the perfect example of how people don't understand object
>> detection... what other word than SHOULD do you think Lasse should be
>> using? it can't be MUST, we have no control over people, so what
>> exactly do you suggest?

>
>No, it should be SHOULD which is exactly my point. To make it more explicit
>for you, gone is the certainty that object and property checking just works.


Of course it does work if it's written correctly, however your user
agent sniffing cannot be written correctly in such manner that works
with even known browsers, you're relying on some very weird
hypothetical browser that does not exist - making it with IE would be
pretty easy.

>BTW, the first Fudgilla Service Pack was released. Fudgilla will now check
>for instances of proprietary Microsoft objects/properties anywhere in the
>script and if it finds even one it will mess up the script anyway.


So it will "mess up the script" across the proprietary Microsoft
object like "document" then? and pray tell me how this is done, the
code analysis methods would be really useful to me for other things,
any language is good.

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

 
Reply With Quote
 
Douglas Crockford
Guest
Posts: n/a
 
      09-25-2003
This thread grows tiresome.

 
Reply With Quote
 
Richard Cornford
Guest
Posts: n/a
 
      09-25-2003
"Fotios" <(E-Mail Removed)> wrote in message
news:3f735942$0$215$(E-Mail Removed)...
<snip>
>"code analysis methods" when all that would be needed is
>simple substring detection?


And now a browser that supposedly was created to promote web standards
is in breach of ECMA 262.

Richard.


 
Reply With Quote
 
Jim Ley
Guest
Posts: n/a
 
      09-25-2003
On Fri, 26 Sep 2003 00:12:17 +0100, "Fotios" <(E-Mail Removed)> wrote:

>"code analysis methods" when all that would be needed is simple substring
>detection?


no, that doesn't work...

all='getElementById'
document[all]()

or even just

document.fred

that uses IE proprietary, yet ain't gonna be found by simple substring
detection.

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Python Logic Map/Logic Flow Chart. (Example Provided) spike Python 8 02-09-2010 12:31 PM
Asynchronous Logic Gates and Analog Logic Gates Jyoti Ballabh Software 3 11-26-2009 06:48 PM
link to download forte free agent 3.3 ( freeware ) news reader agent jameshanley39@yahoo.co.uk Computer Information 1 07-27-2007 12:23 AM
OT: Paging Agent Jar, Agent Briscobar FrisbeeŽ MCSE 0 02-08-2007 07:41 PM
Dhcp Relay Agent And Acl On Sw 3750, DHCP Relay Agent and ACL on Sw 3750 Vimokh Cisco 3 09-06-2006 02:16 AM



Advertisments