Niraj Choubey
Niraj Choubey

Reputation: 4040

JavaScript enabled/disabled in browser

How to find whether a user has enabled or disabled JavaScript in the browser or the browser does not support JavaScript?

Upvotes: 0

Views: 1041

Answers (5)

Pranay Rana
Pranay Rana

Reputation: 176956

Actually this is no direct way to detect javascript enable/disable. Go through below article explain how to detact javascript enable or disable

Detect if JavaScript is enabled in ASPX

Upvotes: 3

Kris van der Mast
Kris van der Mast

Reputation: 16623

There is not really a reliable way to do this. Besides it's up to the user of the browser to enable javascript or not. Try to make your site in such a way that it downgrades gracefully to a state where it doesn't have to support javascript but still can have the most important functionality.

Html also provides the < noscript> element in which you could state to the user that (s)he could turn on javascript to have a better experience. But still it's up to him/her to do so.

Upvotes: 2

Matteo Mosca
Matteo Mosca

Reputation: 7458

There is no way, but it shouldn't concern you.

Design your pages so they work properly without any javascript. When you're done, add unobtrousive javascript that will "override" links or submits behaviour so the js enabled users will get the nice js features, and for those with no js support the site will nicely degrade to the standard features.

Upvotes: 2

SLaks
SLaks

Reputation: 888233

You can a <script> tag to that sends users to a page that uses Javascript.

For example: (in your <head>)

<script type="text/javascript">
    location.replace("JavaScript-Enabled.aspx");
</script>

However, the proper way to handle this is to allow your pages to work both with and without Javascript.

Upvotes: 1

Bart van Heukelom
Bart van Heukelom

Reputation: 44124

There isn't really a stable way, but you could do something like having Javascript send a message to your server which will set a flag there. If the message is not sent, you know Javascript is disabled.

Upvotes: 0

Related Questions