Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Varbase FAQs 9.2.1 Minor update available for module varbase_faqs (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module displays a confirmation pop-up when a user clicks on an external link, allowing them to choose whether to proceed. It offers customization options for the pop-up message, buttons, and allows for whitelisting specific domains or links to bypass the pop-up.

Overview

External Link Pop-up module provides confirmation pop-up on external link click, that follows out of the site. The module supports multiple pop-ups and have options to allow some links don't show pop-ups.

The module uses `core/drupal.dialog` library, which is build on `jquery.ui.dialog` library.

Configuration

The configuration page is in "Administation -> Configuration -> Content Authoring" menu. The path is `/admin/config/content/external_link_popup`.

Global configuration includes domains whitelist field. Whitelist configuration is described below in "Excluding Links" section. Each of pop-ups has next options:

- "Show close icon" checkbox, check to chow close ([X]) icon in pop-up header.
- "Title" - fill with text displayed in pop-up title area.
- "Body" - pop-up main text.
- "Yes button" - text on button which allows user follow the link.
- "No button" - text on button which cancels jump and closes pop-up.
- "Domains" - white-space separated list of top-level domains
to show this pop-up. Domain 'domain.com' matches 'domain.com' and '*.domain.com'.
- "Open in new tab by default" - check to open links having NO TARGET attribute
specified in new tab. If a link has target attribute it is used to detect how
to open it.

ATTENTION: It recommended to configure target attribute on the link for the
cases when JS is disabled or broken on the page, to open a link in new tab even
if external link popup isn't shown.

Excluding Links

The module provides ability to exlude external domains from pop-up show. To do it fill "Allowed Sites" field in configuration with white-space separated list of domains to excude. Each domain you defined also matches for it subdomains, e.g. 'domain.com' matches 'domain.com' and '*.domain.com'.

The module provide ability to exclude specific link from pop-up show. Just
add to the link `external-link-popup-disabled` CSS class.

Force Pop-up show

The module provide ability to define which popup to show on a link with
`data-external-link-popup-id` attribute. It overrides any settings for the link
except `external-link-popup-disabled` CSS class. It also works for local links.
Use Popup machine name as a value.

Theming

The pop-ups are based on `jquery.ui.dialog` and uses JQuery UI styling. The module pop-up has the next additional classes on a dialog wrapper:
- `external-link-popup` - global class for all dialogs,
- `external-link-popup-id-%id%` - class for particular pop-up, where %id% is it's machine name,
e.g. `external-link-popup-id-default` for default pop-up,
- `external-link-popup-body` - class for Body section inside of the pop-up content,

See jQuery UI styling framework for full information, here are some typical cases:
- Width. JQuery Dialog requires pop-up width on creation and it equeals to 85%
of document width for responsive purposes*. You can control `min-width` and `max-width`
of the pop-up with CSS, e.g.

.external-link-popup {
  min-width: 320px;
  max-width: 600px;
}

- Header. To style header use `.external-link-popup .ui-dialog-titlebar` CSS rule.
- Content. To style content use `.external-link-popup .ui-dialog-content` CSS rule.
- Buttons Area. To style the area use `.external-link-popup .ui-dialog-buttonpane`
CSS rule.
- Button. To style button use `.external-link-popup .ui-dialog-buttonpane .ui-button`
CSS rule. Use `:first-child` and `:last-child` pseudo-classes to style specific button.

Events

The external link popup triggers custom events based on
actions taken on the popup.

Events list:
- `externalLinkPopup:yes` - Popup Ok / Yes button clicked, popup is closed.
- `externalLinkPopup:no` - Popup is closed without going external site.
- `externalLinkPopup:notFound` - Popup not configured.
- `externalLinkPopup:skipped` - No popup shown due to whitelisted domain
or the link has "external-link-popup-disabled" class.

General example:

$(window).on('externalLinkPopup:{ACTION}', function(event) {
  console.log(event.popupId, event.domain, event.target);
});

Multi-Language support

The module supports translation via Configuration Translation module from version 8.x-1.4.

References

- http://api.jqueryui.com/dialog/ - JQuery UI Dialog documentation.
- http://api.jqueryui.com/theming/css-framework/ - JQuery UI styling framework.

Activity

Total releases
1
First release
Mar 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Dormant

Releases

Version Type Release date
2.0.1 Stable Mar 19, 2025