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