10

Is there a way to check whether a browser supports U2F or not?

I know that right now, Chrome is the only browser that officially does U2F, but there are addons for Firefox and there may also be customized browsers which may have gotten U2F.

I don't want to ditch such browsers like Google does, because the addon users wouldn't be able to use it.

I saw that GitHub seems to have a way to see it (because it distinguished between Firefox with and without addon), but I have no idea how to do that.

1
  • 1
    by the way: I dont want to use Useragent based filtering for 3 reasons: a) it IS possible to check more directly, as seen with github, b) when any new browser implements U2F everyone has to update their filters, and addons usually dont get recognized at all, c) why do you guys think that pretty much all browsers have "Mozilla" in their UA Strings?
    – My1
    Commented Apr 11, 2016 at 22:13

2 Answers 2

1

Use library caniuse-support, which uses information from the service caniuse.com (https://caniuse.com/#feat=u2f) and uses library bowser (browser detector):

const {
  getSupport,
  currentBrowser,
} = CaniuseSupport;

const test1 = getSupport("u2f"); // current browser

console.log(
  "Get feature support of U2F current browser (" +
    currentBrowser.id +
    " " +
    currentBrowser.version +
    "):",
  test1.level
);

CodePen sandbox

1
  • intresting idea but doesnt seem to work properly: Get feature support of U2F current browser (opera 57.0): none aside from the fact that the caniuse database itself is flawed with chrome for android, which DOES support U2F (given that you have google authenticator installed), but is marked as straight red
    – My1
    Commented Feb 3, 2019 at 16:39
0

It's 2019 now and there actually have been some interesting improvements to the entire U2F stuff.

The U2F browser API has essentially been replaced by WebAuthn, and while sure that is throwing out some older browsers, there isnt really any relevant older browser that actually supports the U2F API which is still in a lot of use as chrome auto-updates anyway and chromium and its forks are basically the only browsers that natively supported U2F out of the box.

and with the new webauthn, you have functions you can actually check for, based on what I library I use has in an example document:

if (!navigator.credentials || !navigator.credentials.create) { 
  //try navigator.credentials.get for login instead of create
  //tell the user
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.