Make a website not run in any version of IE

5

I have a site that should not run in any version of IE , when they try to open the url I want a background-image to appear, site is not supported in IE .

Is this possible?

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 was:

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

    
asked by anonymous 27.05.2015 / 18:18

2 answers

4

One way to detect the browser is by checking the user-agent property, as is proposed by this response from 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>
    
27.05.2015 / 18:25
2

Mind this approach hurts concepts from the Web itself. Are you talking about 1% of how much? 1% of 10 goes there but 1% of 10k is another! Taking into account Progressive Enhacement the footprint would be to identify the object of the browser is not compatible, because if not friend you would have to close the door for everyone.

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

And for that, they already created a library js Moms mode called Modernizr gives you simple fallback of css if that's the case or with just an if / else you do what you want, without needing that 1990 approach that does not guarantee you much.
Link of documentation translated filé

And remember always use code open -source !! rsrsr

    
07.08.2015 / 09:42