kev wood Posted June 13, 2008 Share Posted June 13, 2008 i have built a web based application and have been testing it in firefox and now found that most of the site does not work in IE which is not a big surprise to me but how can i stop the users from loading this in IE. This application will only ever be availble to people who buy it so it will come with a user guide explaining how to download and install firefox and why it should be used over IE but i also want it to direct the user to the firefox download page if they dont already have it. Would it also be possible to write a piece of code that will look to see if they have firefox on there pc already and if so load it in to firefox instead of using IE. Quote Link to comment https://forums.phpfreaks.com/topic/110066-stop-page-loading-in-ie/ Share on other sites More sharing options...
npsari Posted June 13, 2008 Share Posted June 13, 2008 I think javascript may do it This 'Add to favorites' script knows if it is Firefox or IE <script language="JAVASCRIPT" type="TEXT/JAVASCRIPT"> <!-- function favoris() { if ( navigator.appName != 'Microsoft Internet Explorer' ) { window.sidebar.addPanel("Zortin.com","http://www.zortin.com/",""); } else { window.external.AddFavorite("http://www.zortin.com/","Zortin.com"); } } // --> </script> Cant you trun it somehow Quote Link to comment https://forums.phpfreaks.com/topic/110066-stop-page-loading-in-ie/#findComment-564794 Share on other sites More sharing options...
craygo Posted June 13, 2008 Share Posted June 13, 2008 You can check to see which browser the user is using and give a message to them and redirect. you can use $_SERVER['HTTP_USER_AGENT'] to detect the browser type Here is a function I got from somewhere quite a while ago <?php function browser_detection( $which_test ) { // initialize the variables $browser = ''; $dom_browser = ''; // set to lower case to avoid errors, check to see if http_user_agent is set $navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : ''; // run through the main browser possibilities, assign them to the main $browser variable if (stristr($navigator_user_agent, "opera")) { $browser = 'opera'; $dom_browser = true; } elseif (stristr($navigator_user_agent, "msie 4")) { $browser = 'msie4'; $dom_browser = false; } elseif (stristr($navigator_user_agent, "msie 6")) { $browser = 'msie6'; $dom_browser = false; } elseif (stristr($navigator_user_agent, "msie 7")) { $browser = 'msie7'; $dom_browser = false; } elseif (stristr($navigator_user_agent, "msie")) { $browser = 'msie'; $dom_browser = true; } elseif ((stristr($navigator_user_agent, "konqueror")) || (stristr($navigator_user_agent, "safari"))) { $browser = 'safari'; $dom_browser = true; } elseif (stristr($navigator_user_agent, "gecko")) { $browser = 'mozilla'; $dom_browser = true; } elseif (stristr($navigator_user_agent, "mozilla/4")) { $browser = 'ns4'; $dom_browser = false; } else { $dom_browser = false; $browser = false; } // return the test result you want if ( $which_test == 'browser' ) { return $browser; } elseif ( $which_test == 'dom' ) { return $dom_browser; // note: $dom_browser is a boolean value, true/false, so you can just test if // it's true or not. } } $user_browser = browser_detection("browser"); echo $user_browser."<br />"; ?> Ray Quote Link to comment https://forums.phpfreaks.com/topic/110066-stop-page-loading-in-ie/#findComment-564803 Share on other sites More sharing options...
kev wood Posted June 13, 2008 Author Share Posted June 13, 2008 thanks for the reply i found a javascript solution to the problem using the window.location function. the prob is now as i have not fixed the code yet it is just running through the code and keeps trying to load the page over and over. If the user is in IE it does the redirect fine but if the not it keeps looping around the code and begins to load the page runs the check again and then try to load the page again and again and again. the page never loads. here is the code incase you want it for future use <script> if(navigator.userAgent.indexOf("Firefox") != -1) { window.location = "http://www.acmeart.co.uk/mercury/index.php"; //this line is the one making the page keep loading. it is already on this page } else { window.location = "http://www.mozilla.org/products/firefox/"; } </script> Quote Link to comment https://forums.phpfreaks.com/topic/110066-stop-page-loading-in-ie/#findComment-564853 Share on other sites More sharing options...
craygo Posted June 13, 2008 Share Posted June 13, 2008 Problem is, what is some people have javascript disabled?! Using the function above you can do this $browser = browser_detection("browser"); if($browser != "mozilla"){ header('Location:http://somepage.html'); } else { // run your page below } ?> Ray Quote Link to comment https://forums.phpfreaks.com/topic/110066-stop-page-loading-in-ie/#findComment-564858 Share on other sites More sharing options...
kev wood Posted June 13, 2008 Author Share Posted June 13, 2008 good point didnt think of that. well at least the user would have had fun when things didnt work properly in IE because it is sh*t and should be destroyed all together. any enough bout how sh*t IE is so if i use your php function and take this of the end $user_browser = browser_detection("browser"); echo $user_browser."<br />"; and replace it with $browser = browser_detection("browser"); if($browser != "mozilla"){ header('Location:http://somepage.html'); } else { // run your page below } it will then redirect the user if they are not using firefox. Quote Link to comment https://forums.phpfreaks.com/topic/110066-stop-page-loading-in-ie/#findComment-564865 Share on other sites More sharing options...
craygo Posted June 13, 2008 Share Posted June 13, 2008 correct! Quote Link to comment https://forums.phpfreaks.com/topic/110066-stop-page-loading-in-ie/#findComment-564881 Share on other sites More sharing options...
roopurt18 Posted June 13, 2008 Share Posted June 13, 2008 So you built an application and failed to: 1) Use standard practices that worked in all browsers 2) Test it in different environment Thus the conclusion that you draw is that IE is garbage? I use FF over IE myself but only because I perform web development, otherwise I'd be perfectly happy using IE for basic web browsing. You're free to distribute your application as you see fit, but intentionally limiting your market is rarely a successful strategy. Quote Problem is, what is some people have javascript disabled?! Using the function above you can do this Web applications require Javascript to be enabled. Quote Link to comment https://forums.phpfreaks.com/topic/110066-stop-page-loading-in-ie/#findComment-564925 Share on other sites More sharing options...
kev wood Posted June 17, 2008 Author Share Posted June 17, 2008 The application was started by someone else he had set up the application to look how it should then left the company. I then was given the job of finishing. As none of the design work was undertaken by me I rather stupidly thought that it would have been tested in all browsers. I have given the application all its functionality and enabled it to do what it does. it now directs the user to the firefox download page if they are not already using it. And lets face it if it makes just a few more people start to use firefox it might start to make Microsoft understand that they need some major updating done with IE to bring it up to sprrd with the rest of the browsers and the standards. Quote Link to comment https://forums.phpfreaks.com/topic/110066-stop-page-loading-in-ie/#findComment-567190 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.