Reputation: 3919
I'm making a user-agent switcher for Chrome using the experimental API WebRequest, and I'd like to display the current user-agent used.
For that, I have to get the current version of Chrome, but I don't find anything about that in the doc and I can't access to the "chrome://version" page due to security considerations.
Do you have an idea to help me?
Upvotes: 1
Views: 2694
Reputation: 29746
try
function getChromeVersion(){
var match = window.navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9\.]+)/);
return match ? match[1] : null;
}
or use https://github.com/DamonOehlman/detect-browser for Multi-Browser Support.
Upvotes: 1
Reputation: 9172
You can always use the good old navigator
object (navigator.userAgent
is the exact property, but it contains many other informations), it's available to extensions.
Upvotes: 1