Re: Best way to deal with Javascript (in)compatibility using PHP?
- From: Michael Winter <m.winter@xxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 29 Jun 2005 15:39:40 GMT
On 29/06/2005 13:39, Philip Ronan wrote:
[snip]
http://www.google.co.uk/search?q=javascript+object+detection
The term, object detection, probably isn't the best one to use. It has connotations with 'Browser detection via object inference', as you might notice by looking at some of the search results. A better phrase to consider is feature detection, and it is this principle that the OP should be trying to embrace.
The actual browser that is in use should normally be of absolutely /no/ concern. The only interest should be what the capabilities are of that browser (hence /feature/ detection).
Feature detection typically involves a one-to-one analysis of the environment. Simply assuming that because the host supports - for instance, document.getElementById - that it must automatically support the entire W3C DOM Core module is clearly flawed (though that's what many seem to do). Instead, one determines what is necessary to perform a particular task, and then sets about finding if those methods and objects are indeed present in the host environment. Doing this in an efficient manner typically requires a thorough understanding of ECMAScript.
The FAQ notes for comp.lang.javascript gives a more in-depth treatment of why the various detection methods are flawed, and why feature detection is vastly superior (including some simpler examples). If you have particular issues, post there.
See <URL:http://www.jibbering.com/faq/faq_notes/not_browser_detect.html>
Mike
-- Michael Winter Replace ".invalid" with ".uk" to reply by e-mail. .
- References:
- Best way to deal with Javascript (in)compatibility using PHP?
- From: christian9997
- Re: Best way to deal with Javascript (in)compatibility using PHP?
- From: Philip Ronan
- Best way to deal with Javascript (in)compatibility using PHP?
- Prev by Date: Re: Reverse mysql-result
- Next by Date: Re: 401.3 ACL issue in IIS
- Previous by thread: Re: Best way to deal with Javascript (in)compatibility using PHP?
- Next by thread: Re: Best way to deal with Javascript (in)compatibility using PHP?
- Index(es):
Relevant Pages
|