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
https://forums.phpfreaks.com/topic/244385-http_user_agent-questioncomparison/
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?

Archived

This topic is now archived and is closed to further replies.

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