Page 1 of 1

browser detection

Posted: Thu Jul 07, 2011 12:11 am
by jonathon
I was just wondering if anybody knew of any plugins for browser detection. It's only so that i can put a small notice on my page if a user is using an older browser. As i haven't font much testing in early versions of ie etc. I did have a Google for it, couldnt find anything definitive

Re: browser detection

Posted: Thu Jul 07, 2011 9:22 am
by jacek
What do you mean by plugins :? ?

http://www.google.co.uk/search?hl=en&q= ... +detection

First links seems like what you want ?

Re: browser detection

Posted: Thu Jul 07, 2011 10:13 am
by conradk
Try not to use PHP for that if you don't need it to pre process the page. It will demand server resources that is not needed.

Have a look at this w3schools link. You have it all in Javascript here:
http://www.w3schools.com/js/js_browser.asp

Else, the browser name is simply contained in a variable which you ca find on this page:
http://php.net/manual/fr/reserved.variables.server.php

Good luck.

Re: browser detection

Posted: Thu Jul 07, 2011 1:21 pm
by jonathon
Hmmm, it would appear that I chose to ignore that link. Possibly because it had quirks mode in the url. :) thanks

Re: browser detection

Posted: Thu Jul 07, 2011 6:13 pm
by libeco
conradk wrote:Try not to use PHP for that if you don't need it to pre process the page. It will demand server resources that is not needed.

Have a look at this w3schools link. You have it all in Javascript here:
http://www.w3schools.com/js/js_browser.asp

Else, the browser name is simply contained in a variable which you ca find on this page:
http://php.net/manual/fr/reserved.variables.server.php

Good luck.


Hmm, who do you make websites for? Yourself, or your users? Why would you use extra processing power of your visitors' PC rather than using server resources which you already pay for? ;)

Re: browser detection

Posted: Thu Jul 07, 2011 6:59 pm
by conradk
libeco wrote:
conradk wrote:Try not to use PHP for that if you don't need it to pre process the page. It will demand server resources that is not needed.

Have a look at this w3schools link. You have it all in Javascript here:
http://www.w3schools.com/js/js_browser.asp

Else, the browser name is simply contained in a variable which you ca find on this page:
http://php.net/manual/fr/reserved.variables.server.php

Good luck.


Hmm, who do you make websites for? Yourself, or your users? Why would you use extra processing power of your visitors' PC rather than using server resources which you already pay for? ;)


Well, ok, it depends on what kind of hosting you're on. I'm on shared hosting (max 20 request at the same time...). If you have a dedicated server, these things should be in PHP, but if not, Javascript will usually be faster, don't you think ?

Re: browser detection

Posted: Thu Jul 07, 2011 8:23 pm
by libeco
You're only adding extra processing after the page has been served by using JavaScript. Granted, you won't usually notice it a lot, but generally I think it's better to stress your server a bit, than to stress the users PC...

Re: browser detection

Posted: Thu Jul 07, 2011 9:36 pm
by jacek
libeco wrote:but generally I think it's better to stress your server a bit, than to stress the users PC...

Generally I disagree with this, the server has to serve hundreds of pages, meaning a small amount of processing added to each request will add a overall bigger effect. If you have each user work it out with their browser, the load is distributed away form the server meaning it can server more total requests.

In this case, it would be better for the server to do it, as not everyone has javascript enabled and this is apparently something that is critical for the site to work correctly.

Also, is is normally possible to make a page look acceptable in older browsers without having to resort to detecting them and serving special styles.