The IE or FF detector

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
egturnkey
Forum Commoner
Posts: 34
Joined: Sun Jul 26, 2009 7:35 pm

The IE or FF detector

Post by egturnkey »

Hello Friends,

Problem of today ( we seek for php help ) as following ,

we know all that PNG images not shown well on IE6 and some "css'ers" given us a solution --> fine 1

but if that PNG is within css hover code no way to be working correctly i.e i've tried millions of ways all failed


the only way i've got is to use something called "filter"

but that filter is not working for FF and only working for IE

so i wonder if


- we are able to set a php code

if ( it IE) then ( run style_ie.css ) if not ( IE ) then ( run style_ff.css )


hence is there any code to detect it and can be re-write as if X then Y and if not then Z


hope you got wt i mean ....

thanks in advance
User avatar
Weiry
Forum Contributor
Posts: 323
Joined: Wed Sep 09, 2009 5:55 am
Location: Australia

Re: The IE or FF detector

Post by Weiry »

Im not really sure of a shorthand way of doing this, but i checked through the php function list and found
get_browser()

This is a copy/paste example from the website. The only problem is that it requires the list of browsers in the array to be up to date if any new browsers are released.
Detect Browser Class
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: The IE or FF detector

Post by pickle »

The filter: declaration is ignored by Firefox. You should be able to put it in your CSS & Firefox should work fine.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: The IE or FF detector

Post by Eric! »

In PHP you can also check $_SERVER['HTTP_USER_AGENT'] for the information provided by the browser...which is sort of similar to get_browser();
Post Reply