Page 1 of 1

If IE browser do this if firefox do that...

Posted: Fri Sep 23, 2005 9:31 am
by murph2481
How do i write an if function that based on the browser that the surfer is using it does something different?

I want a function that does

If Microsoft IE then:
<link>http://user+domain.com@ftp.domain.com</link>

if Firefox then
<link>http://user@domain.com@ftp.domain.com</link>

My FTP server always adds a @domain.com to each user name. I want a link that will link the user into the FTP site and ask for a password for that user. IE and Firefox handle it very differently.

Thanks,
Dan
:D

Posted: Fri Sep 23, 2005 9:38 am
by feyd
use get_browser() if possible.. I've written a "local" version of it before, but it wasn't very fun (ran a bit slow due to huge file to parse to pull all the browser data)

alternately, you can use a basic regex against the user agent found in $_SERVER['HTTP_USER_AGENT']

unfortunately, both bank on whether the client is sending the "correct" agent string... :?


Alternately, you could use a bit of Javascript, which roughly does the same as checking the user agent...