use noscript html tag when user disable the javascript in browser, guide user how to enable the js in different browser and retu

If user disable the javascript in browser, most site will not view normally, you can pompt user this and

show user a page to guide user how to enable the javascript in different browser.

 

1. Add noscript in root frame page or master page or every page.

<noscript>
        <meta http-equiv="refresh" content="0;url=<%= Url.Action( "NoJS", ConstantString.PagesKey, new {target = Request.Url} ) %>" />
   </noscript>

 

Note: You must transfer the current request url to the nojs page so as to direct back since this type of

redirect, it can not get the reffer url in code, the reffer url wil be null.

 

2. Add a new page NoJS.aspx to guide user how to enable js in different browser and return previous url,

<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1">
    <title>Javascript Disabled </title>
    <style type="text/css">
        body {
            background-color: #f1f8fe;
            font-size: 12px;
            color: #564b47;
            padding: 20px;
            margin: 0px;
            text-align: center;
        }
        #content {
            text-align: left;
            vertical-align: middle;
            margin: 10px auto;
            padding: 10px;
            width: 550px;
            background-color: #ffffff;
            border: 1px dashed #A1D0EC;
        }
        .active
        {
            color:#EB6C20 !important;
            text-decoration:underline;
        }
    </style>
</head>
<body>
    <div id="content">
        <p>
            In order to view pages normally you must have javascript enabled on
            your web-browser. To enable javscript please follow these instructions, then click
            the link below to be sent back to the previous page.</p>
        <p>
            <strong>Internet Explorer 7 or 8</strong>
            <ol>
                <li>Click the Tools menu.</li>
                <li>Select Internet Options.</li>
                <li>Click the Security tab.</li>
                <li>Click the Custom Level button.</li>
                <li>Scroll down until you see the 'Scripting' section. Select the 'Enable' radio button
                    for 'Active Scripting.'</li>
                <li>Click the OK button.</li>
                <li>Click the Yes button in the confirmation window.</li>
            </ol>
        </p>
        <p>
            <strong>Firefox 3 </strong>
            <ol>
                <li>Click the Tools menu.</li>
                <li>Select Options.</li>
                <li>Click the Contents tab.</li>
                <li>Select the 'Enable JavaScript' checkbox.</li>
                <li>Click the OK button.</li>
            </ol>
            <p>
                <strong>Safari 3</strong>
                <ol>
                    <li>Click the Safari menu.</li>
                    <li>Select Preferences.</li>
                    <li>Click the Security tab.</li>
                    <li>Select the 'Enable JavaScript' checkbox.</li>
                </ol>
            </p>
            <p>
                <a class="active" href="<%= (Request["target"] != null) ? Request["target"].ToString() : ConfigUtility.GetConfigString(ConstantString.HomeUrlConfigKey) %>" id="backPage">Back to Previous Page</a></p>
    </div>
</body>

</html>

 

it will redirect back when user enable the javascript according to the guidence.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值