How to check if browser supports navigator.permissions.query({ name: 'microphone' }) ?
Firefox has error when using the above code:
Uncaught (in promise) TypeError: ‘microphone’ (value of ‘name’ member of PermissionDescriptor) is not a valid value for enumeration PermissionName.
But surprizingly when you log this code in firefox you get "function" !!!:
typeof navigator.permissions.query
How to check if browser supports navigator.permissions.query({ name: 'microphone' }) ?
>Solution :
It returns a promise, you can try using catch.
i.e.:
navigator.permissions.query({ name: 'microphone' }).catch(e => console.log("i'm catching the error"))
You can also await and use try/catch approach.