Check Javascript Disabled in Clients Browser and ASP.Net solution

These days none of the web application can work without Javascript.

Q. Why should we check if javascript is disabled in the client browser

A. First to provide better service to the client on UI (priority) and second to protect your application from intrusion (it can be a motive)

Now it is really simple to do:

What I did is in my main Layout page say “_Layout.cshtml” with the “<head>” tag and added this code in the tag

<noscript>
<meta http-equiv="Refresh" content="0;URL=@Url.Content("~/Errorpage/JavaScriptDisabled")"></noscript>

Now in the above code, you can see a Url.Content which is the controller with action to be called when the javascript is disabled in the client’s browser.

The output for that is

Please appreciate if it was helpful.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.