delegateAnchorClicksToFront

Listen for clicks on links and programatic window opens to automatically decide whether to open them via Front

❗️

This function has been deprecated. Use delegateNewWindowsToFront instead.

function delegateAnchorClicksToFront(): void;

Calling this function will add an event listener on the window object to delegate opening some links with Front. It will automatically call Front.openUrl if one of the following conditions is true:

  • The link opens a new window (target property of the anchor is set to _blank)
  • The link is to compose an email (href property of the anchor starts with mailto:)

The goal of this function is to make it easier to have links compatible with Front. Its usage is totally opt-in and you can always stop the propagation of the click event to prevent triggering the listener.

📘

Including the Plugin SDK as a global library, will be call this function automatically.

import {delegateAnchorClickToFront} from '@frontapp/plugin-bridge';

delegateAnchorClickToFront();