为什么此脚本在Chrome中有效但在Firefox中无效?

时间:2017-08-13 12:20:06

标签: javascript google-chrome firefox

我有这个脚本,但它只适用于Chrome。不在Firefox工作的问题可能是什么?

<script type="text/javascript">
$(function() {
    $('form').submit(function() {
        $.post('/parts', function() {
            window.location = '/parts';
        });
    });
});
</script>

1 个答案:

答案 0 :(得分:0)

尝试将其更改为:

    using System;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;


    namespace WebApplication1.Models
    {
        public class AuthorizeFilter : AuthorizeAttribute
        {
            public bool verifyToken(string token)
            {
                return false;
            }
            protected override bool AuthorizeCore(HttpContextBase httpContext)
            {

                // Get the headers
                var headers = httpContext.Request.Headers;
                //your token verification 
                if (verifyToken(headers["SomeHeader"]))
                {
                    return true;
                }
                return false;

            }



            protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
            {
                try
                {
                    filterContext.Result = new RedirectToRouteResult(new
                    RouteValueDictionary(new { controller = "Home", action = "NotAuthorzied" }));
                }
                catch (Exception ex)
                {

                }
            }
        }
    }