Fsoft Posted August 8, 2009 Share Posted August 8, 2009 Hello, I need a small help , I used this fuction : function get_user_browser() { $u_agent = $_SERVER['HTTP_USER_AGENT']; $ub = ''; if(preg_match('/MSIE/i',$u_agent)) { $ub = "ie"; } elseif(preg_match('/Firefox/i',$u_agent)) { $ub = "firefox"; } elseif(preg_match('/Safari/i',$u_agent)) { $ub = "safari"; } elseif(preg_match('/Chrome/i',$u_agent)) { $ub = "chrome"; } elseif(preg_match('/Flock/i',$u_agent)) { $ub = "flock"; } elseif(preg_match('/Opera/i',$u_agent)) { $ub = "opera"; } return $ub; } $browser = get_user_browser(); if($browser == "ie") { }else { echo "<center><b>Sorry but our system says that you are not using Microsoft Internet Explorer.<br> You can not access this with any other browser.. <br>You must use Internet explorer to explore this site.. <br>Thanks for understanding, Please try again later with Internet Explorer.</b></center>"; exit(); } This function I found on php.net while searching for a good function of browser detection, the problem is due to some reasons I want my site to open in Only Internet explorer. It seemed to work totally nice and correctly, all the browsers used to show error else then IE. But my friend just installed a plugin available for firefox, using that you can make your firefox IE, which means all the scripts will think your browser is IE but actually it is firfox SO this function actually failed .. I want to know if there is a good simple function in JAVASCRIPT which can detect if browser is IE or not? Please help, I am null in javascript, never did. Please help. Thank you very much... Quote Link to comment https://forums.phpfreaks.com/topic/169411-brower-detection-in-javascript/ Share on other sites More sharing options...
RichardRotterdam Posted August 8, 2009 Share Posted August 8, 2009 This function I found on php.net while searching for a good function of browser detection, the problem is due to some reasons I want my site to open in Only Internet explorer. Why I can't imagine any good reason for blocking a type of browser. But my friend just installed a plugin available for firefox, using that you can make your firefox IE, which means all the scripts will think your browser is IE but actually it is firfox That must be the user agent switcher for firefox I love that plugin for websites that block firefox. But fixing this in javascript won't help you resolve this. Quote Link to comment https://forums.phpfreaks.com/topic/169411-brower-detection-in-javascript/#findComment-893827 Share on other sites More sharing options...
Fsoft Posted August 9, 2009 Author Share Posted August 9, 2009 This function I found on php.net while searching for a good function of browser detection, the problem is due to some reasons I want my site to open in Only Internet explorer. Why I can't imagine any good reason for blocking a type of browser. But my friend just installed a plugin available for firefox, using that you can make your firefox IE, which means all the scripts will think your browser is IE but actually it is firfox That must be the user agent switcher for firefox I love that plugin for websites that block firefox. But fixing this in javascript won't help you resolve this. here is the reason : http://www.phpfreaks.com/forums/index.php/topic,264100.0.html Quote Link to comment https://forums.phpfreaks.com/topic/169411-brower-detection-in-javascript/#findComment-893836 Share on other sites More sharing options...
RichardRotterdam Posted August 9, 2009 Share Posted August 9, 2009 It might be a reason but it's still not a GOOD reason. Besides that there is simply no way to fully make sure what browser someone is using other then that forcing someone to use IE isn't an option. And even if you can only view a page in IE you can still get the video which is mentioned to you earlier. You might also want to view the following thread: http://www.phpfreaks.com/forums/index.php/topic,248798.0.html Quote Link to comment https://forums.phpfreaks.com/topic/169411-brower-detection-in-javascript/#findComment-894100 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.