Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How to do HTML coding to specifically Internet Explorer users?

I have created an eportfolio, however it contains css coding that is not currently compatible with the majority of Internet Explorer versions (IE sucks!!). How do I add a message (using HTML coding?) to ONLY Internet Explorer users to tell them to switch browsers?

Update:

Yes, I know that IE supports css, but it doesn't support all css specified by the W3C. Also, this e-portfolio is for school coursework so I really doubt that I'll miss any hiring opportunities. I didn't bother adding that info to make it quick and short.

7 Answers

Relevance
  • 10 years ago
    Favorite Answer

    I have to do this all the time, IE is awful. Specify your non-IE css file first, then you can add a second with the [if IE] tag which will only get processed by IE.

    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />

    <!--[if IE]>

    <link href="@Url.Content("~/Content/Site-IE.css")" rel="stylesheet" type="text/css" />

    <![endif]-->

    If you're looking to just show something on IE, in your CSS, you can specify a div on your website to display:block (or no style at all), and display:none on your non-IE stylesheet:

    (in html)

    <div id="useNonIE">You are using Internet Explorer, please use Mozilla or Chrome</div>

    (in IE css)

    #useNonIE { display:block; }

    (in non-IE css)

    #useNonIE { display:none; }

    Obviously if you have server side scripting capabilities this can be done much easier, but with strictly HTML this would probably be best

    Source(s): Software Developer
  • Anonymous
    10 years ago

    If you're doing this, especially trying to advertise yourself, telling the viewer to use a different browser is as bad or worse than having something display incorrectly.

    Next, HTML and CSS are supported by IE back to IE6 and before. However, most IE users will be using IE6-8 with a fair amount using IE9. If you want to do something where your web portfolio matters, learn how to write code that works in all major browsers (IE6+, Safari 4+, Opera 9+, Chrome, Firefox 3.5+).

    It's really not that difficult. In the worst case scenario, learn what "graceful degradation" is and learn how to use that instead of telling other people what to do. To make this even easier, there are HTML conditional statements that only IE supports. These conditionals can also let you see which version of IE it is and give them a specific CSS file based on that.

    If you want someone to hire you, they're going to be telling you what to do, and chances are they'll also want to reach customers without telling their customers to use a different browser.

  • Astano
    Lv 7
    10 years ago

    I have never come across this problem because if you use CSS in the right way it is totally avoidable, having a script for specific internet browsers is a waste of space, you might as well find the CSS that's causing the display issues and replace them with code that works on all browsers. JavaScript isn't going to solve the problem, what if they have it disabled? Then they have hit another wall.

    Source(s): Programmer
  • Terry
    Lv 4
    10 years ago

    "you can target any IE past version 5 with the conditional comment <!--[If IE]> HTML <![endif]-->

    Furthermore, you can target any version of IE since version 5. Practically there are 4 sufficiently different versions of IE to consider though: 5, 5.5, 6 and 7. To target any one of these on there own is quite simple, add the version number to the expression above, e.g. <!--[If IE 6]> HTML <![endif]--> will target IE6 only."

  • How do you think about the answers? You can sign in to vote the answer.
  • ?
    Lv 6
    10 years ago

    You can use a tag like similar to this and just have the CSS for that specific version of IE on a separate .js page.

    <link rel="stylesheet" type="text/css" href="iespecific.css" />

    //Steve

  • Anonymous
    10 years ago

    If you paste the following in-between the <head></head> tags of your document, when you try to load the page with Internet Exporer, you'll get a overlay appear with a white box and message. The message is configurable to whatever you want (I changed this slightly from my original version as I use this code to check for IE6 and show the user a message with links to other browser download links as I refuse to support IE6).

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/...

    <script>

    var IE = (navigator.userAgent.indexOf("MSIE")>=0) ? true : false;

    if(IE){

    $(function(){

    $("<div>")

    .css({

    'position': 'absolute',

    'top': '0px',

    'left': '0px',

    backgroundColor: 'black',

    'opacity': '0.75',

    'width': '100%',

    'height': $(window).height(),

    zIndex: 5000

    })

    .appendTo("body");

    $("<div><p>Please switch to another browser</p></div>")

    .css({

    backgroundColor: 'white',

    'top': '45%',

    'left': '35%',

    'margin': 'auto',

    'padding': '50px',

    marginTop: -100,

    width: 250,

    paddingRight: 10,

    'position': 'absolute',

    zIndex: 6000

    })

    .appendTo("body");

    });

    }

    </script>

  • 10 years ago

    There is some code you can put where if something doesn't display properly you can put a code to display text and you could put please switch browsers or something like that or you could just put it as normal text somewhere on your page

    Source(s): Took a webdesign class
Still have questions? Get your answers by asking now.