Contents

Permissions

This page gives an overview of the app permissions in Molybden.

Permissions in Molybden refer to the various access rights that a website or web application may request to interact with certain resources or features on a user’s device. These permissions ensure user privacy, security, and control over what websites and web apps can access.

Permission requests

When a website wants to access a certain resource or feature, such as camera, microphone, location, notifications, etc., it needs to request the user’s permission.

By default, Molybden will display a permission prompt asking the user to grant or deny access.

Permissions prompt

The decision will be remembered for the current website and the user will not be asked again. To remember decision, Molybden will store the decision in the browser profile.

Note: The decision will be stored in the browser profile for the HTTPS and HTTP websites only. If you load a web page with custom scheme, the decision will be stored in a memory variable and remembered during the current session only.

If the user has denied the permission, Molybden will remember the decision for the current website and won’t ask the user again. You can reset the decision programmatically.

If the user hasn’t made a decision yet, Molybden will ask the user again the next time the website requests the permission.

Granting permission

You can grant specific permission programmatically. This will prevent the permission prompt from being displayed:

auto permissions = app->profile()->permissions();
permissions->onRequestPermission = [](const RequestPermissionArgs& args,
                                      RequestPermissionAction action) {
  // Allow access to the camera and microphone.
  if (args.permission_type == PermissionType::kVideoCapture ||
      args.permission_type == PermissionType::kAudioCapture) {
    action.grant();
  } else {
    // Ask the user to allow or deny the requested permission.
    action.ask();
  }
};

To find out the type of the requested permission, use the permission_type field of the RequestPermissionArgs structure.

Resetting permission

You can always reset the decision for specific website programmatically:

permissions->resetPermission(PermissionType::kVideoCapture, website_url);
permissions->resetPermission(PermissionType::kAudioCapture, website_url);

Checking permission status

To check the permission status for specific website, use the getPermissionStatus() method:

auto permission_status = permissions->getPermissionStatus(
    PermissionType::kVideoCapture,
    website_url);
if (permission_status == PermissionStatus::kGranted) {
  // The video capture permission is granted for the website.
}

Permission types

Molybden supports the following permission types:

Permission type Description
kNotifications Ability to show desktop notifications.
kGeolocation Access to the user’s physical location.
kAudioCapture Access to the user’s microphone.
kVideoCapture Access to the user’s camera.
kClipboardReadWrite Access to copy and paste data to/from the clipboard.
kClipboardSanitizedWrite  
kLocalFonts  
kAccessibilityEvents Access to the accessibility events.
kSensors  
kBackgroundSync  
kDurableStorage Access to browser storage (localStorage, sessionStorage, IndexedDB).
kMidi  
kMidiSysex  
kProtectedMediaIdentifier  
On this page
Top