I’ve been developing some extensions and web apps that need to use the new Chromebook file API. But on the other hand, I don’t want to see the sad faces of all the users that will install this extension just to see that it’s not working for them on their Chrome browser. The quick and easy solution is to do something like this:
var ua = window.navigator.userAgent;
// Then check if the UA is something like: Mozilla/5.0 (X11; CrOS i686 0.12.433) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.77 Safari/534.30
Now, if you got back in the user agent some string like: CrOS you are on ChromeOS device.
Btw, you can even tell the version of the chrome in the end of this string. So you can save a call to ‘about:version’ page. It’s useful because it won’t force you to add permissions to the extension. I found that some developers are using permissions that are making users uncomfortable… As always, think of you when you asking the user to approve some permissions.
While I was working on that, I developed this little chrome extension that give you all the shortcuts/utils in one click.
Be strong and let me know if it’s not working for you.