Re: Best way to deal with Javascript (in)compatibility using PHP?
- From: Manuel Lemos <mlemos@xxxxxxx>
- Date: Wed, 29 Jun 2005 19:40:07 -0300
Hello,
on 06/29/2005 09:24 AM christian9997@xxxxxxxxxxx said the following:
We would be interested in hearing about the way people deal with javascript browser compatibility using PHP. There must be some much simpler ways of doing this but we are not sure how to do it.
Often is not a matter of dealing with browser differences but also different Javascript versions in different versions of the same browser.
The most reliable way to solve that problem is to provide alternate Javascript code that is conditionally executed at Javascript run time depending on what the browser supports.
That is the solution used by this form validation class for instance to validate e-mail addresses. If the regular expression objects are available, it uses them, otherwise it uses a more basic type of e-mail address validation:
http://www.phpclasses.org/formsgeneration
if(s.search) { return (s.search(new RegExp('email-regular-expression','gi'))>=0) } else { some other type of basic validation; }
Regular expression detection support is made checking the existence of the search method in the string object.
--
Regards, Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html .
- References:
- Best way to deal with Javascript (in)compatibility using PHP?
- From: christian9997
- Best way to deal with Javascript (in)compatibility using PHP?
- Prev by Date: Re: How to make mulitlingual website?
- Next by Date: Re: >> Very Simple PHP DOM Question..Please help!
- Previous by thread: Re: Best way to deal with Javascript (in)compatibility using PHP?
- Next by thread: IValue
- Index(es):
Relevant Pages
|