Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4103464
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:57:43+00:00 2026-05-20T20:57:43+00:00

I have a script that works fine in all browsers except ie6 (including ie7

  • 0

I have a script that works fine in all browsers except ie6 (including ie7 and ie8).
Is there any semi reliable way I can exclude this nefarious browser.

I’ve tried this:

<!--[if !IE 6]>
<?php include("fconditionals.php"); ?>
<![endif]-->

and this:

$user_agent = getenv("HTTP_USER_AGENT");
if (preg_match("MSIE 6", $user_agent)) 
{ 
include("fconditionals.php");
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T20:57:43+00:00Added an answer on May 20, 2026 at 8:57 pm

    The first thing you tried (Conditional Comments) won’t work because the include is done on the server, while the page is being generated, and the conditional comments are only checked by the browser after the page has been downloaded.

    The conditional comments will exclude the generated code from being displayed in IE6, but it will still be run by the server.

    Additionally, the conditional comments in the format you’ve used them here will also exclude the code from being displayed by all non-IE browsers. If you only want to affect IE, you need to re-format it so that the other browsers don’t treat the code inside as a comment, by using the <![if !IE 6]> syntax instead of <!--[if !IE 6]>.

    That method still won’t stop the code from being run on the server though.

    The second method you tried is more likely to be closer to what you actually want to do. However, please note that although PHP does receive the USER_AGENT string, it is possible in most browsers to spoof the USER_AGENT, and some privacy/security products actively remove it, as do some web proxies. In other words, the USER_AGENT string is not a 100% reliable way of determining what browser someone is using.

    That said, if you have specific PHP code that you want to exlude from being executed only for IE6, then it may be the only viable solution.

    The reason this didn’t work for you is that your code includes only IE6 rather than excluding it. You need to add a ‘not’ operator (!) in front of the preg_match().

    By the way: In your example code, you have $user_agent = getenv("HTTP_USER_AGENT");. It’s worth pointing out that $_SERVER['USER_AGENT'] is already available as a variable, you don’t need to use getenv().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script that works fine in all browsers that I have tested
I have a custom jQuery script that works fine in all bowsers but one
I have a JQuery slider which works fine in all browsers except IE(always a
I have a script that works fine on my test server (using IIS6). The
I have a java script code that works fine when run through a browser,
I have the following code that works fine in IE: <HTML> <BODY> <script language=JavaScript>
I have a php mail script that works well except for one minor fact.
With help from you guys I now have a script that works like a
I have the following script that works well in Firefox and Chrome (not sure
I have this RewriteRule that works too well :-) RewriteRule ^([^/]*)/$ /script.html?id=$1 [L] The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.