me1000 Posted January 6, 2007 Share Posted January 6, 2007 I have a browser detection script, and i want the user to be prompted if they are using IE (any version)so here is what i have so far..[code]if ( $client_data['browser'] == "Microsoft Internet Explorer". *)[/code]the * is a wildcard character in everything else i have ever used. thats just the opening, i have the rest of it but there was no need to post it.so basically if anything at all follows the Microsoft Internet Explorer then it needs execute the if command.Thanks, Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted January 6, 2007 Share Posted January 6, 2007 [code=php:0]if (preg_match('/^Microsoft Internet Explorer/', $client_data['browser'])){[/code]or the slightly faster alternative, though it doesn't force "Microsoft Internet Explorer" to be at the front of the string...[code=php:0]if (strstr($client_data['browser'], 'Microsoft Internet Explorer')){[/code]there might be alternative solutions as well Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted January 6, 2007 Share Posted January 6, 2007 Don't think there is.You need to use something like:[code]<?php$browser = get_browser(null, true);if (preg_match('/Internet Explorer/', $browser['parent'])){ //what ever you are doing}?>[/code]You will have to check what $browser['parent'] actually outputs for IE I know for FF it says 'Firefox' but what ever it does put that string in where I put MSIE and you shoudl be fine. Quote Link to comment Share on other sites More sharing options...
me1000 Posted January 6, 2007 Author Share Posted January 6, 2007 [quote author=genericnumber1 link=topic=121295.msg498350#msg498350 date=1168116631][code=php:0]if (preg_match('/^Microsoft Internet Explorer/', $client_data['browser'])){[/code]or the slightly faster alternative, though it doesn't force "Microsoft Internet Explorer" to be at the front of the string...[code=php:0]if (strstr($client_data['browser'], 'Microsoft Internet Explorer')){[/code]there might be alternative solutions as well[/quote]Thank you!it works fine now! :) 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.