Q&A - mdrv/wbh GitHub Wiki

💬 Questions & Answers

🎁 Features

Which browser feature can be checked?

Read this page to see the list. If a browser feature you need isn’t there, you can add a discussion or issue.

Which level should I embed for *this* feature?

There are four levels that you can embed for each feature:

  • 🟥 CRITICAL (0): This feature must be available on the user’s browser without any exception.
  • 🔵 IMPORTANT (1): Some pages of your website implements this feature that could break if the browser does not support.
  • 🟢 OPTIONAL (2): A nice to have; the user’s browser might not render webpage correctly, but it won’t impact much.
  • 🌑 UNUSED (3): You website is not implementing this feature, but might someday.

When a browser does not pass the check, its WBH score will be one point lower than the checked feature.

The other two levels (UNSUPPORTED & MAXIMUM) are only used for scoring.

What does each feature’s score property actually do?

It functions as feature sorting from highest (the most important) to lowest. The highest score is 50.

Am I able to change the recommended browsers on built-in mountError?

Currently, mountError lists the latest Chrome and Firefox as the recommended browser. As for now, you can’t change it.

Otherwise, you can take the data provided by WBH and implement the error page yourself.

Example return of WBH.lastResult / WBH.lastResultAsync
{
  "score": -1,
  "unsupported": [
    {
      "data": {
        "origin": "caniuse",
        "title": "AVIF image format",
        "description": "A modern image format based on the [AV1 video format](/av1)...",
        "chrome": "85",
        "chrome_android": "137",
        "firefox": "113",
        "firefox_android": "139",
        "url": "https://caniuse.com/avif"
      },
      "key": "avif",
      "name": "AVIF image format",
      "caniuse": "avif",
      "isAsync": true,
      "level": 0, /* CRITICAL */
      "score": 50,
      "wisdom": "Most images hosted on this website are highly-optimized AVIF files."
    },
    {
      "data": {
        "origin": "mdn",
        "chrome": "86",
        "chrome_android": "109",
        "firefox": "111",
        "firefox_android": "111",
        "url": "https://developer.mozilla.org/docs/Web/API/StorageManager/getDirectory"
      },
      "key": "fileSystemApi",
      "name": "FileSystem API",
      "caniuse": [
        "api",
        "StorageManager",
        "getDirectory"
      ],
      "level": 1, /* IMPORTANT */
      "score": 50,
      "wisdom": "Needed to store binary data locally in an organized manner."
    },
    /* more features not supported by the browser used */
  ]
}

Should I use the sync or async version?

The WBH class comes with two variants: lastResult & lastResultAsync. If you need a feature that can only be checked asynchronously (marked by isAsync: true), you need to use the async version.

As of v257, only two features need asynchronous check:

  • avif
  • jpegxl

Why is *this* feature not implemented yet?

We strive to make this project as modular and lightweight as possible. Since there are still many browser features not covered by this project, we will focus on that first while keeping the bundle size at minimum.

💻 Development

Can I contribute to this project?

As of current version (v257), the author is not accepting pull requests. The author is thoroughly testing and using it internally and the underlying code still have a chance be replaced or modified greatly that could impact API/nature of this project.

If you’re still willing to create a pull request, in best case, your contribution will be merged when it’s close to the next major release (v260 in Q4 2025).

Can I use this library for my commercial project?

As long as you give credit to the author, you are free to implement this library in any project (even commercial ones).

You can mention the project name (WBH / @mdrv/wbh) with hyperlink to the repo alongside the developer’s name (MEDRIVIA / Umar Alfarouk) to differentiate from others that might have similar namings. For example:

Credits

This project uses:

  • WBH by MEDRIVIA
  • ... (mentioning other projects)

Am I allowed to fork and modify this project?

Yes, however, every modification of this library is entitled to covered with the same license (GPL-3.0). Any attempt to transform or modify this library into a closed-source projects are not allowed.

This TLDRLegal page by FOSSA explains concisely about the GPL-3.0 license.

Why is *this* version I’m using deprecated/removed?

To achieve rapid development and minimize time spent, every major release will only keep (and deprecate) the preceding version and remove the older ones. Here is a breakdown:

  • v257.x.x:
    • @mdrv/wbh → v257 (latest)
    • @mdrv/wbh/v257 → v257 (latest)
  • v260.x.x:
    • @mdrv/wbh → v260 (latest
    • @mdrv/wbh/v260 → v260 (latest)
    • @mdrv/wbh/v257 → v257 (deprecated)
  • v264.x.x:
    • @mdrv/wbh → v264 (latest)
    • @mdrv/wbh/v264 → v264 (latest)
    • @mdrv/wbh/v260 → v260 (deprecated)
    • 🗑️ v257 (removed)

To make sure you don’t get impacted by API changes on newer releases, please add a subpath on every import code by specifying the 3-digit major version of this project.

❓ Others

My related question isn’t here.

Feel free to add a discussion in this GitHub repo.

⚠️ **GitHub.com Fallback** ⚠️