BandonRandon Posted January 11, 2009 Share Posted January 11, 2009 Hello, I've been playing with [if ie] conditional statements for a while however the problem I'm having now is that i want a script to not run if ie6 and run if everything else. I've searched the web and wasn't able to really a solution so I wrote my own which seams to work but I'm not sure it's the best way to do it. Basically this javascript goes and get's the browser and decides if it has a MSIE 6 if so it won't run the java. The java file basically is just add scrollbar styling for a div which in ie6 it won't show any scrollbars so by disabling the script i get stand scrollbars. <?php $agent = getenv("HTTP_USER_AGENT"); if (preg_match("/MSIE 6/i", $agent)) { $isie6= ("true"); } if($isie6 != "true"){ echo "<script type='text/javascript' src='scripts/myscript.js'></script>"; } ?> I checked the browser list herehttp://www.pgts.com.au/download/data/browser_list.txt and i think this may have a problem is someone was using ie 7.66 though also i'm trying to learn how to be more efficient with my coding. Thanks, Brandon Link to comment https://forums.phpfreaks.com/topic/140380-not-run-a-script-if-ie6/ Share on other sites More sharing options...
trq Posted January 11, 2009 Share Posted January 11, 2009 Detecting browsers is much better handled client side (javascript) in my opinion. Link to comment https://forums.phpfreaks.com/topic/140380-not-run-a-script-if-ie6/#findComment-734619 Share on other sites More sharing options...
BandonRandon Posted January 11, 2009 Author Share Posted January 11, 2009 thorpe thanks for the reply, I FULLY understand this is not a javascript support forum but I know there are a lot of people who are very diverse in various languages. So I'm going to ask and if no one replies or tells me a better way to do it in php then that's fine. If i wanted to use a client side (javascript) browser detect for ie6 how would i go about that. Thanks! Link to comment https://forums.phpfreaks.com/topic/140380-not-run-a-script-if-ie6/#findComment-734623 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.