Example 1 — Feature-Detect Support
Check whether the Permissions API exists before calling query().
if ("permissions" in navigator) {
console.log("permissions available");
} else {
console.log("permissions missing");
} How It Works
- Use
in. Checks whether the property exists onnavigator. - Modern path. Evergreen browsers expose the Permissions API.
- Missing path. Skip
query()and rely on feature-API error handling instead. - Rule. Always detect before chaining
.query().

