Make a site not run on any version of IE

Asked

Viewed 114 times

5

I have a website that should not run on any version of IE, when trying to open the url I want a background-image that I will mount by saying that my site is not supported on IE.

This is possible to do?

I put this solution in my code:

<script type="text/javascript">
    function msieversion() {
        var ua = window.navigator.userAgent;
        var msie = ua.indexOf("MSIE ");

        // Se for o IE, retorna a versão
        if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./))
            return parseInt(ua.substring(msie + 5, ua.indexOf(".", msie)));      
        else
            // Se estiver usando outro navegador, retorna 0                 
            return 0;

       return false;
    }

    var IE = msieversion();

    if (IE !== 0) {
        document.body.style.backgroundImage = "url('http://i.stack.imgur.com/mTXDZ.jpg')";
        // Fazer algo a mais aqui ...
    } else {
        // O usuário usa outro navegador
    }
</script>

and it worked but not the way I wanted to see the image of how it looked:

inserir a descrição da imagem aqui

I would like that only appears the background and nothing else wanted that as if my site ceases to exist in the

  • 3

    Why do you want to block IE? something that doesn’t work?

  • 1

    not only that it is horrible to work with this browser however you try you will never get 100% and I have no time to waste with it when it is a browser that less than 1% of the population ultiliza and my site and turned to games soon abuses effects and make it work in ie and a hell

  • Kirito, the code I posted worked on your case?

  • 1

    friend I’ll test Aja and that I’m at work and I wrapped up in something else here

  • Man, it’s better to ride a bugger than not run around and make a mistake like that to your visitor’s face. Especially when the guy uses IE, let’s face it, whoever uses IE doesn’t have basic IT knowledge (won’t install another browser)... ie, -1 visitor/client for you.

  • 1

    @Diegomoreira and friend makes sense and that as my site is aimed at the gamer public I do not think it is necessary to cultivate the exlorer because until then I publish target are players so it may be that there is one who uses the most I find it difficult

  • The reason it presents is an unfortunate amateurism.. the only one who loses is yourself. If you write concise code, including common sense in using ready-made scripts as jquery plugins, you will not have problems with any browser..

Show 2 more comments

2 answers

4


One way to detect the browser is by checking the property user-agent, as you propose is response from the SOEN:

function msieversion() {
    var ua = window.navigator.userAgent;
    var msie = ua.indexOf("MSIE ");

    // Se for o IE, retorna a versão
    if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./))
        return parseInt(ua.substring(msie + 5, ua.indexOf(".", msie)));      
    else
        // Se estiver usando outro navegador, retorna 0                 
        return 0;

   return false;
}

var IE = msieversion();

if (IE !== 0) {
    document.getElementById("bgImagem").style.display = "inline";
    // Fazer algo a mais aqui ...
} else {
    // O usuário usa outro navegador
}
#bgImagem {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -5000;
}
<div align="center"><img src="http://i.stack.imgur.com/mTXDZ.jpg" style="display: none;" id="bgImagem"></div>

  • friend not the div can be placed anywhere only my code

  • @Kirito I don’t understand what you mean, it didn’t work?

  • 1

    ss was not working I moved here and it worked brigadeo by the help

2

Face this approach hurts concepts of the Web itself.You’re talking about 1% of how much? 1% of 10 goes there but 1% of 10k is another neon! Taking into account Progressive Enhacement the footprint would be to identify the object that the browser version is not compatible, because if not friend you would have to close the door for all.

Who assures you that the browser the guy is using is compatible with some Feature of your website?

And for that, they’ve already created a library js way mom who calls herself Modernizr you prove fallback simple css if it is the case or with just an if/Else you do what you want, without needing this 1990 approach that does not guarantee you much.
Translated documentation link filet

And remember to always use open-source code!! rsrsr

Browser other questions tagged

You are not signed in. Login or sign up in order to post.