Re: Best way to deal with Javascript (in)compatibility using PHP?



"christian9997@xxxxxxxxxxx" 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/


.



Relevant Pages

  • Re: Slow Downloads
    ... The link I provided was for Broadband Reports, not Cox. ... comfortable switching from IE to another browser. ... Are there any Web sites that cause no problems at all? ... America's website takes a long time to load. ...
    (microsoft.public.windowsxp.general)
  • Re: single page apps, URL hash setting, bookmarking, & the back button.
    ... illusion for users with no expectations to begin with. ... Incompetence and broken browser behavior were definite factors (with ... links because they find the website hard to use, ...
    (comp.lang.javascript)
  • Re: Highjacked homepage
    ... This may be caused by spyware/malware that's gotten installed on ... Windows Defender and/or Spybot Search & Destroy ... section, uncheck "Enable third-party browser extensions", click Apply, click ... website, while the website of choice is unobtainable also this website has ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: NXP Gone mad
    ... responsible for the development of the new NXP site. ... displayed in a new window. ... - the NXP web site is particuarly Browser ... In one browser on visting the website after the SECOND invitation to the ...
    (comp.arch.embedded)
  • Re: Im sure I shall regret this.............
    ... set up a local website. ... I see a square in the middle of the browser, ... suggest this is one of the things a Tourist Info office might be for. ... Well, okay, I'm a nitpicking perfectionist. ...
    (uk.rec.sheds)