user462455
user462455

Reputation: 13598

Javascript status from User Agent

Is it possible to detect if Javascript is enabled/disabled on a browser just by looking at User-Agent.

If yes, what should I be looking for. If no, what is the best way to detect if javascript is enabled/disabled on a user's browser

Upvotes: 0

Views: 1845

Answers (2)

antyrat
antyrat

Reputation: 27765

Best way to detect if JS is disabled by using HTML <noscript> tag. It's supported by all known browsers, even old.

<noscript>
    this content will be visible only if JS is disabled
</noscript>

But User-Agent didn't contain such information. + if JS is disabled how do you want to get User-Agent info? The only possible way is server-side then.

Upvotes: 0

Miguel-F
Miguel-F

Reputation: 13548

No, there is not a way to detect javascript via the user-agent string. The user agent can be spoofed very easily anyway.

See antyrat's answer for how you should be checking for javascript.

Upvotes: 3

Related Questions