5

I want to check JavaScript Version in my web browser.

Is navigator Object return proper JavaScript version?

navigator.appVersion;  /*Is it correct?*/
navigator.appCodeName;
navigator.appName;

Is there any way to detect exact JavaScript Version from Browser console or anything else?

6
  • 1
    Already asked here: stackoverflow.com/questions/4271566/… Commented Mar 23, 2017 at 9:16
  • What are you planning to do once you've detected the version, whatever that means? Commented Mar 23, 2017 at 9:35
  • I want to show warning/alert to user, If some new features of latest Javascript version are not supported current(old) version Of Javascript in clients browser. @torazaburo Commented Mar 23, 2017 at 9:40
  • And also want to know about navigator.appVersion; is returning exact version of Javascript or Not. @torazaburo Commented Mar 23, 2017 at 9:43
  • Maybe this question is not 100% duplicate of that question you mentioned :( :( :( @torazaburo Commented Mar 23, 2017 at 9:45

1 Answer 1

9

Browsers don't give any real version, because they don't exactly support any one version. They support some (or most) features of some versions.

Any support declared for "JavaScript 1.x" is just a legacy hack for compatibility with Netscape.

Similarly, these navigator fields are useless on purpose. In the past they have been misused to block browsers so much, that the spec now recommends all browsers to lie and say they are Netscape 4.0.

On the web, in general, you should never check version of anything to decide whether it supports the features you need, because it's too easy to make an invalid assumption and break your code in some browser, including future ones you can't test now (e.g. a feature may not be related to the version you assume, or browsers may lie about versions they support in order to work around sites blocking them).

You should use feature detection instead.

You can detect presence of individual JavaScript features by running them and seeing if they work. If the new feature requires a new syntax, you can try running that syntax inside eval. See how it's done on: https://kangax.github.io/compat-table/es6/ (there's a (c) icon with detection code next to features when you expand the list).

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for your explanation! I updated my question. Please check.
On Chromium chrome://version/ give the name and version of the JS Engine (V8). Is there a way in Firefox to display SpiderMonker version (there is nothing in about:support)?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.