Jump to content

how to detect what browser your visitor is using


eleven0

Recommended Posts

first....you should make your site work on all browsers....

 

but, PHP has browser detection stuff. check out http://us3.php.net/function.get-browser. it will not work out of the box, you need to setup browscap...check out http://browsers.garykeith.com/

 

...and dido on what DarkWater says...i use browser detection for tracking/stats, but that's it

Link to comment
Share on other sites

What the hell, that isn't a thing you can just do. If someone visits your site with IE5 (is there anyone left on IE5?), you'll tell him that he needs to upgrade? That's a personal choice. Instead have your styles written in a way to support old browsers. And by old, nobody means IE4 or Netscape 4, but IE6 being the worst case which with some pain can render things almost appropriately.

 

EDIT: The last 2 guys who posted caught me on time, but i'm posting this anyway.

Link to comment
Share on other sites

IE6 being the worst case which with some pain can render things almost appropriately.

 

Yep, IE6 is a bloody pain for everyone, mostly the CSS programmers though...  ;D That's what made me just learn the basics of CSS and that's what I prefer with php, it's moreso cross-browser.

Link to comment
Share on other sites

Browsers can easily be spoofed, so don't bother.  I mean, you can certainly do checks in both PHP AND Javascript for browser info, but it may not be valid. =P

 

I agree that you shouldn't use this to keep a perfect record of what is coming and going, but it is a good way to get a guesstimate.

 

 

first....you should make your site work on all browsers....

 

You may want your page/site to work differently on different browsers...

 

 

As for your question, you can use PHP, using the links rhodesa posted, or you can use javascript

 

var browser=navigator.appName;
alert(browser);

 

Link to comment
Share on other sites

thanks for the replies, I at least want to put a notice up in the top of my site to warn my users.

 

I asked this because, lately I accessed my web site with a public pc using IE6. Everything was messed up. Although, It looks okay in my pc(same vers.). I'm just tired of seeing these problems.

 

Everything in my site looks great in every browser except IE6< versions.

Link to comment
Share on other sites

It works allright but there are still many things that need to be fixed.

 

http://us3.php.net/manual/en/function.get-browser.php#51673

 

I also found this at rhodesa's link, it works pretty good. No details, simply prints out what browser your visitor is using, including the version. Using this I can put up a notice for IE6 users, which was the point.

 

Thanks again.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.