You are here: Re: Best way to deal with Javascript (in)compatibility using PHP? « PHP Programming Language « IT news, forums, messages
Re: Best way to deal with Javascript (in)compatibility using PHP?

Posted by Philip Ronan on 06/29/05 15:39

"christian9997@hotmail.com" wrote:

> Hi
>
> We have started off using a $_GET parameter to keep track of the user's
> browser:

Bad idea. Unless you don't really care what happens when people share links
to your site, or visit your site from search engines.

> We detect what browser the visitor is using when he first arrives on
> our website then we do a redirect to the same page adding on
> "&browser=IE" or "&browser=DOM" at the end of the url (and we keep the
> browser parameter in the URL the whole time he is on the website),

That is probably going to damage your search engine ranking.

> this
> enables us to use the following PHP method:
>
> function javascript($name) {
> if($_GET[brow] == "IE") {
> return "document.all('$name')";
> }
> else {
> return "document.getElementById('$name')";
> }
> }

Has it not occurred to you that you can do all of this in Javascript?

function getObject(n) {
if (document.all) return document.all(n);
else return document.getElementById(n);
}

Here are a couple of links for you:

http://www.google.co.uk/search?q=javascript+object+detection
http://en.wikipedia.org/wiki/KISS_principle


--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация