I'm developing a Chrome extension and I'm wondering is there a way that I can detect which version of Chrome the user is using?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
Get major version of Chrome as an integer:
I've updated the original answer, so that it does not throw an exception in other browsers, and does not use deprecated features.
You can also set
minimum_chrome_version
in the manifest to not let users with older versions install it.Here is a version, based on the answer from @serg, that extracts all of the elements of the version number:
The naming of the elements in the object that is returned is based on this convention, though you can of course adapt it to be based on this instead.