or run

npx @tessl/cli init
Log in

Version

Files

tile.json

task.mdevals/scenario-5/

Browser Compatibility Checker

A utility that analyzes website visitor browser information and determines compatibility using flexible browser name matching.

Requirements

Build a browser compatibility checking system that accepts user agent strings and checks them against a set of compatibility rules. The system should support both full browser names and common short aliases for convenience.

Core Functionality

The system should provide a function that:

  • Accepts a user agent string
  • Accepts a list of compatible browser names (using either full names or common aliases)
  • Returns whether the browser is compatible with the application

Browser Alias Handling

The checker must support both full browser names (e.g., "Google Chrome", "Mozilla Firefox") and common short aliases (e.g., "chrome", "firefox") interchangeably. When checking compatibility, the system should recognize that aliases refer to their full browser name equivalents.

Test Cases

  • Passing a Chrome user agent string with "chrome" in the compatibility list returns true @test
  • Passing a Firefox user agent string with "firefox" in the compatibility list returns true @test
  • Passing an Edge user agent string with "edge" in the compatibility list returns true @test
  • Passing an Internet Explorer user agent string with "ie" in the compatibility list returns true @test
  • Passing a Safari user agent string with an empty compatibility list returns false @test

Implementation

@generates

API

/**
 * Checks if a browser is compatible based on its user agent string.
 *
 * @param {string} userAgent - The user agent string to check
 * @param {string[]} compatibleBrowsers - Array of compatible browser names or aliases
 * @returns {boolean} True if the browser is in the compatibility list, false otherwise
 */
function checkCompatibility(userAgent, compatibleBrowsers) {
  // IMPLEMENTATION HERE
}

module.exports = {
  checkCompatibility,
};

Dependencies { .dependencies }

bowser { .dependency }

Provides browser detection and parsing capabilities from user agent strings.