shamwowy Posted August 10, 2011 Share Posted August 10, 2011 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. Quote Link to comment Share on other sites More sharing options...
voip03 Posted August 10, 2011 Share Posted August 10, 2011 <?php echo $_SERVER['HTTP_USER_AGENT'] . "\n\n"; $browser = get_browser(null, true); print_r($browser); ?> can u get the print out Quote Link to comment Share on other sites More sharing options...
Morg. Posted August 10, 2011 Share Posted August 10, 2011 Well, it's simple $bad_user_agent_regex_list="Opera 5.5|Opera 5.4| etc."; $t=preg_match("/($bad_user_agent_regex_list)/i",$_SERVER['HTTP_USER_AGENT']); if($t==false || $t==0){ // woot no match, this should be good ? } Quote Link to comment Share on other sites More sharing options...
shamwowy Posted August 10, 2011 Author Share Posted August 10, 2011 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.