Jump to content

Detecting Mobile Browsers


chibineku
 Share

Recommended Posts

I have tested my code on my blackberry and most of it looks weird and the javascript doesn't work, even with javascript enabled on the device. I don't expect many people will be trying to place product orders on their phones, but I would like to be able to include them if possible. I would ideally like to use PHP to detect browser, as I already have it working to change content depending on whether the user is on AOL and it'd be an easy addition. Any thoughts? I mean, what's the protocol for browsers choosing the mobile stylesheet and can I piggy back that anyhow? Perhaps embed my PHP in the mobile stylesheet?

Link to comment
Share on other sites

You could put PHP code in a stylesheet, but it's not going to request the stylesheet until after it's requested the page. So you wouldn't know they are a mobile browser until after the page has already loaded. Print out the $_SERVER array and see if you can find anything that indicates it's a mobile device.

Link to comment
Share on other sites

Es muy smarto. Or something. Ta!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...