eleven0 Posted August 29, 2008 Share Posted August 29, 2008 I know this is possible but Can i do it with php? or javascript? Also, I want to restrict mysite to certain browsers. So I won't have to spend time fixing my css for those old browsers. thanks... Quote Link to comment https://forums.phpfreaks.com/topic/121867-how-to-detect-what-browser-your-visitor-is-using/ Share on other sites More sharing options...
DarkWater Posted August 29, 2008 Share Posted August 29, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/121867-how-to-detect-what-browser-your-visitor-is-using/#findComment-628771 Share on other sites More sharing options...
BlueSkyIS Posted August 29, 2008 Share Posted August 29, 2008 only target the latest or near-latest browsers, forget the rest. if they're still using Netscape 4.0, they need to get with the program. Quote Link to comment https://forums.phpfreaks.com/topic/121867-how-to-detect-what-browser-your-visitor-is-using/#findComment-628777 Share on other sites More sharing options...
rhodesa Posted August 29, 2008 Share Posted August 29, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/121867-how-to-detect-what-browser-your-visitor-is-using/#findComment-628779 Share on other sites More sharing options...
Fadion Posted August 29, 2008 Share Posted August 29, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/121867-how-to-detect-what-browser-your-visitor-is-using/#findComment-628783 Share on other sites More sharing options...
Eggzorcist Posted August 29, 2008 Share Posted August 29, 2008 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... That's what made me just learn the basics of CSS and that's what I prefer with php, it's moreso cross-browser. Quote Link to comment https://forums.phpfreaks.com/topic/121867-how-to-detect-what-browser-your-visitor-is-using/#findComment-628799 Share on other sites More sharing options...
Fadion Posted August 29, 2008 Share Posted August 29, 2008 That's what made me just learn the basics of CSS and that's what I prefer with php, it's moreso cross-browser. Probably because PHP has nothing to do with the browser Quote Link to comment https://forums.phpfreaks.com/topic/121867-how-to-detect-what-browser-your-visitor-is-using/#findComment-628820 Share on other sites More sharing options...
JonnoTheDev Posted August 29, 2008 Share Posted August 29, 2008 What happened to accessibility! Would you stop a blind person accessing your website from a speech based browser because they are not using IE 7 or the latest Firefox? Quote Link to comment https://forums.phpfreaks.com/topic/121867-how-to-detect-what-browser-your-visitor-is-using/#findComment-628851 Share on other sites More sharing options...
The Little Guy Posted August 29, 2008 Share Posted August 29, 2008 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); Quote Link to comment https://forums.phpfreaks.com/topic/121867-how-to-detect-what-browser-your-visitor-is-using/#findComment-628865 Share on other sites More sharing options...
eleven0 Posted August 29, 2008 Author Share Posted August 29, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/121867-how-to-detect-what-browser-your-visitor-is-using/#findComment-629181 Share on other sites More sharing options...
DarkWater Posted August 29, 2008 Share Posted August 29, 2008 Make sure your CSS works in IE6, but don't worry about anything below that. MANY people still use IE6, even though Firefox is just super-amazingly fabulous. Quote Link to comment https://forums.phpfreaks.com/topic/121867-how-to-detect-what-browser-your-visitor-is-using/#findComment-629183 Share on other sites More sharing options...
eleven0 Posted August 29, 2008 Author Share Posted August 29, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/121867-how-to-detect-what-browser-your-visitor-is-using/#findComment-629191 Share on other sites More sharing options...
TraceyK Posted August 30, 2008 Share Posted August 30, 2008 Try this..... http://www.yoingco.com/BrowserCheckPHP.zip Kisses TraceyK Quote Link to comment https://forums.phpfreaks.com/topic/121867-how-to-detect-what-browser-your-visitor-is-using/#findComment-629731 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.