سؤال

I was looking around for a decent solution to preventing any user who uses internet explorer 7 and below from accessing my website. I found none so far. Due to the fact that I'm new to this aspect.

I have Nginx web server on my VPS where my website is, but not sure of any good way to disable internet explorer 7 and below. I was thinking of Javascript way, but didn't find anything...

can anyone lead me to a good start or a direct solution to this!!

Thanks,

هل كانت مفيدة؟

المحلول

HTML 5 Boilerplate uses conditional comments to print a message if a user uses some version of IE.

<!--[if lt IE 8]>
    <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->

Reference about conditional comments

نصائح أخرى

Sorry my previous answer misread the question. This question has been asked before. You can see a great answer here:

https://stackoverflow.com/a/10965091/2338488

Create a class with the ie type:

<!doctype html>
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]>    <html class="ie7"> <![endif]-->
<!--[if IE 8 ]>    <html class="ie8"> <![endif]-->
<!--[if IE 9 ]>    <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]-->
<head>

then write a check

(function ($) {
    "use strict";

    // Detecting IE
    var oldIE;
    if ($('html').is('.ie6, .ie7)) {
        oldIE = true;
    }

    if (oldIE) {
        //redirect to chrome installer
        window.location.replace("http://www.google.com/intl/en_au/chrome/browser/");
    } else {
        // ..And here's the full-fat code for everyone else
    }

}(jQuery));
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top