files/en-us/web/api/permissions/revoke/index.md
{{APIRef("Permissions API")}}{{AvailableInWorkers}}{{deprecated_header}}
The revoke() method of the {{domxref("Permissions")}} interface reverts a currently set permission back to its default state, which is usually prompt.
This method is called on the global {{domxref("Permissions")}} object {{domxref("navigator.permissions")}}.
This method is removed from the main permissions API specification because its use case is unclear.
Permissions are managed by the browser and the current permission model does not involve the site developer being able to imperatively request or revoke permissions. Browsers have shipped this API behind preferences but it's unlikely to reach the standards track.
For more context, see the original discussion to remove permissions.revoke().
revoke(permissionDescriptor)
permissionDescriptor
: An object that sets options for the revoke operation.
The available options for this descriptor depend on the permission type.
All permissions have a name:
name
For the push permissions you can also specify:
userVisibleOnly {{optional_inline}}
false.For the midi permission you can also specify:
sysex {{optional_inline}}
false.A {{jsxref("Promise")}} that calls its fulfillment handler with a {{domxref("PermissionStatus")}} object indicating the result of the request.
PermissionDescriptor information failed in some way, or the permission doesn't exist or is currently unsupported (e.g., midi, or push with userVisibleOnly).This function can be used by an app to request that its own Geolocation API permission be revoked.
function revokePermission() {
navigator.permissions.revoke({ name: "geolocation" }).then((result) => {
report(result.state);
});
}
{{Specifications}}
{{Compat}}