Jump to content

Browser detection


jwwceo

Recommended Posts

What's the best way to do browser detection?

All I need it for is to see if a user is using FireFox. I have some javascript menus on my page and they are positioned absolute on my page. Firefox displays them a little bit off, like 10 pixels off, from where they are supposed to be. So I am hoping to detect Firefox and the output slightly different coordinates.

Thanks!
Link to comment
https://forums.phpfreaks.com/topic/20675-browser-detection/
Share on other sites

My javascript is written by a php program...

so I was really more just looking for the best way to do this in pHP...and then write up a super simple

if ( $browser == Firefox){

echo "this";

}

else {
echo "something else";
}

but I'm don't know which browser detection is the most reliable??? or how to handle the myriad of responses I may get from diferrent versions. Is there a simple one that just detects the browser name, like Firefox?

James
Link to comment
https://forums.phpfreaks.com/topic/20675-browser-detection/#findComment-91435
Share on other sites

Well, if you want to do it with php, here you go:

[code]<?php
echo $_SERVER['HTTP_USER_AGENT'] . "\n\n";

$browser = get_browser(null, true);
print_r($browser);
?> [/code]

For more info try manual: [url=http://ge.php.net/get_browser]http://ge.php.net/get_browser[/url]
Link to comment
https://forums.phpfreaks.com/topic/20675-browser-detection/#findComment-91438
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.