Search code examples
javascriptasp.net-mvcintranet

I do not want to support javascript turned off in an asp.net mvc web/intranet application


I am doing a web application using ajax requests only.

In case there are user trying my application with javascript turned off there should be a nice error message.

When a request comes in to the server there should be automatically an IsAjaxRequest() check and if not show the user a general error.cshtml page.

How can I do that in a generic way for every action and that I have not to manually call this check in every action of my controller?


Solution

  • <head>
        ...
        <noscript>
            <meta http-equiv="refresh" content="0;URL='http://example.com/enablejs.php'">
        </noscript>
        ...
    </head>