php? Posted December 30, 2007 Share Posted December 30, 2007 Would there be any way that i could make it so that when someone enters my website, and if they are using Internet Explorer it says they should download firefox for better performance Quote Link to comment Share on other sites More sharing options...
revraz Posted December 30, 2007 Share Posted December 30, 2007 Yes, but it's not 100%. Check out this code and just take the part you want. http://apptools.com/phptools/browser/source.php Quote Link to comment Share on other sites More sharing options...
php? Posted December 30, 2007 Author Share Posted December 30, 2007 Okay... so i looked that over and for the message prompt that i want ... how would I make it so that if the browser is not Firefox it displays a command prompt. // test for Firefox }elseif(eregi("Firefox", $agent)){ $bd['browser']="Firefox"; $val = stristr($agent, "Firefox"); $val = explode("/",$val); $bd['version'] = $val[1]; Quote Link to comment Share on other sites More sharing options...
php? Posted December 30, 2007 Author Share Posted December 30, 2007 I would want it to be a simple message when they visit the website it checks if their browser is firefox... and if not it displays a little message that says to ensure better performance please use firefox as your browser. An example of the message would be like the one where if you close firefox with more then 1 tab open then it displays a little warning message Quote Link to comment Share on other sites More sharing options...
thebadbad Posted December 31, 2007 Share Posted December 31, 2007 This should work (complete code, also checks for browser): <?php if (!strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox')) { echo '<script type="text/javascript"> alert("Please use Firefox bla bla bla"); </script>'; } ?> EDIT: Think it would be better to add it as an onload event (so the page doesn't keep trying to load in the background while the alert box is open). Like: <body<?php if (!strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox')) { echo ' onload="alert(\'Please use Firefox bla bla bla\');"'; } ?>> 2nd edit: Removed the unnecessary "window." bit from the javascript. Quote Link to comment Share on other sites More sharing options...
php? Posted December 31, 2007 Author Share Posted December 31, 2007 wow thanks Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 31, 2007 Share Posted December 31, 2007 who moved this thread - it belongs in the PHP forum; where it originally was - it's mostly all a PHP based thread. ??? Quote Link to comment Share on other sites More sharing options...
trq Posted December 31, 2007 Share Posted December 31, 2007 who moved this thread Is that a question? Your missing the question mark. I moved it. This entire problem is best handled via Javascript. Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 31, 2007 Share Posted December 31, 2007 who moved this thread Is that a question? Your missing the question mark. I moved it. This entire problem is best handled via Javascript. no it's not; when PHP is involved - the thread should have remained in the PHP forum (but that's ok; pretty much the same thread was re-posted in the PHP forum and I solved the thread there - haha - looks like you deleted that thread also - someones abusing the moderator powers - that's ok - I know I solved it in the PHP forum - haha) and I did not need a question mark - note the emoticon (3 question marks above the head - I think that was sufficient enough to show unknowing and/or a question was being asked). 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.