ASP. net mvc detects the browser version and prompts you to download the updated version.

Source: Internet
Author: User

ASP. net mvc detects the browser version and prompts you to download the updated version.

Some browser versions may not support html5, css3, and adaptive features. In this case, you need to remind the viewer to update the browser version to the latest version.

 

The plug-in used in this article is: http://jreject.turnwheel.com/


HomeController:

 

    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }
    }

 

In Shared/_ Layout. cshtml:

 

<!DOCTYPE html>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    @Styles.Render("~/Content/css")
    @RenderSection("styles", required: false)
    @Scripts.Render("~/bundles/modernizr")
    @Scripts.Render("~/bundles/jquery")
<body>
    @RenderBody()
    
     @RenderSection("scripts", required: false)
</body>

 

In Home/Index. cshtml:

 

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section styles
{
    <link href="~/jReject/css/jquery.reject.css" rel="stylesheet" />
    <style type="text/css">
        
    </style>
}
@section scripts
{
    <script src="~/jReject/js/jquery.reject.js"></script>
    <script type="text/javascript">
        $(function() {
            needDownloadNewExplorer();
        });
        function needDownloadNewExplorer() {
            setTimeout(function () {
                $.reject({
                    reject: {
                        safari: true, // Apple Safari
                        chrome: true, // Google Chrome
                        firefox: true, // Mozilla Firefox
                        msie: true, // Microsoft Internet Explorer
                        opera: true, // Opera
                        konqueror: true, // Konqueror (Linux)
                        unknown: true // Everything else
                    },
                    imagePath: './jReject/images/',
                    browserInfo: { // Settings for which browsers to display
                        chrome: {
                            // Text below the icon
                            text: 'Google Chrome',
                            // URL For icon/text link
                            url: 'http://rj.baidu.com/soft/detail/14744.html',
                            // (Optional) Use "allow" to customized when to show this option
                            // Example: to show chrome only for IE users
                            // allow: { all: false, msie: true }
                        },
                        firefox: {
                            text: 'Mozilla Firefox',
                            url: 'http://rj.baidu.com/soft/detail/11843.html'
                        },
                        safari: {
                            text: 'Safari',
                            url: 'http://www.apple.com/safari/download/'
                        },
                        opera: {
                            text: 'Opera',
                            url: 'http://www.opera.com/download/'
                        },
                        msie: {
                            text: 'Internet Explorer',
                            url: 'http://www.microsoft.com/windows/Internet-explorer/'
                        }
                    },
CloseLink: 'close this Windows ',
Header: 'If this page shows a problem, please download the latest version of the following browser ', // Header Text
                    paragraph1: '', // Paragraph 1
                    paragraph2: '',
                    closeMessage: '' // Message below close window link
                }); // Customized Browsers
            }, 2000);
        }
    </script>
}

 

The effect is as follows:

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.