browser detection

JavaScript related questions should go here.
Post Reply
jonathon
Posts: 50
Joined: Fri May 06, 2011 5:09 pm

browser detection

Post 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
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: browser detection

Post 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 ?
Image
conradk
Posts: 117
Joined: Tue Jul 05, 2011 10:41 pm

Re: browser detection

Post 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.
jonathon
Posts: 50
Joined: Fri May 06, 2011 5:09 pm

Re: browser detection

Post by jonathon »

Hmmm, it would appear that I chose to ignore that link. Possibly because it had quirks mode in the url. :) thanks
libeco
Posts: 104
Joined: Sat May 07, 2011 9:56 am

Re: browser detection

Post 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? ;)
conradk
Posts: 117
Joined: Tue Jul 05, 2011 10:41 pm

Re: browser detection

Post 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 ?
libeco
Posts: 104
Joined: Sat May 07, 2011 9:56 am

Re: browser detection

Post 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...
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: browser detection

Post 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.
Image
Post Reply