Jump to content

HTTP_USER_AGENT question/comparison


shamwowy

Recommended Posts

Hi all. I'm trying to redirect a user if and only if they are using Safari 5.0.5 or below (both Win and Mac). The code is thus:

if ($_SERVER['HTTP_USER_AGENT'] <= 'Safari V. 5.0.5 and lower');   //what should the second half of this line look like?
{
     header( 'location:http://mydomain.com/safari.php' );
}

 

I'm not really sure if there's a nifty RegEx way to do this, and also I don't really know how to do an <= comparison given the http_user_agent returns a giant string of madness. A bunch of my users are stuck with Safari 5.0.5 and can't update to latest, and those versions don't support some of my CSS3 calls.

 

Any help would be most appreciated.

Link to comment
Share on other sites

Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50

 

My issue with the string above is that it seems to be saying Safari version 5.1. Does anyone have an older install of Safari maybe that can show me a different safari string? Or is the number 534.50 above the actual versioning number that I should be concerned with?

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.