Context Menu

The Context Menu is a customizable floating menu that appears when a user long-presses a link in your mobile app. This feature enhances user interaction by offering quick actions such as copying or opening a link. You can dynamically enable or disable the Context Menu at runtime and configure its actions using the Median JavaScript Bridge.

👍

Developer Demo

Display our demo page in your app to test during development https://median.dev/context-menu/

Enabling and Configuring the Context Menu

The Median JavaScript Bridge provides methods to manage the Context Menu in real time.

Enable or Disable the Context Menu

↔️Median JavaScript Bridge

// Enable or disable the context menu at runtime
median.contextMenu.setEnabled(true | false); // or false

Set Available Menu Actions

↔️Median JavaScript Bridge

// Define which actions appear in the context menu
median.contextMenu.setActions(['copyLink', 'openExternal']);

Supported Actions

  • copyLink: Copies the selected link to the device clipboard.
  • openExternal: Opens the selected link in the device’s external browser.

UI Demo

Visual preview of the Context Menu on both iOS and Android:

iOS Android