axllent/silverstripe-links-to-blank

Extension to add JavaScript to all pages to add target="_blank" to all outgoing links & downloads

Installs: 820

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 0

Type:silverstripe-vendormodule

2.0.3 2017-10-17 00:53 UTC

This package is auto-updated.

Last update: 2020-07-27 13:52:45 UTC


README

An extension to automatically add JavaScript on all pages to add target="_blank" to all outgoing links, as well as "download links" such as PDF, ZIP, TAR, DOC, PPT and Excel files.

For security, it also adds rel="[noopener] to the outbound links to prevent cross-site exploit (see here).

Requirements

  • SilverStripe 4+

For SilverStripe 3, please refer to the SilverStripe3 branch.

Installation

Installation can be done either by composer or by manually downloading a release.

Via composer

composer require "axllent/silverstripe-links-to-blank"

Usage

By default the module will automatically include some compressed inline JavaScript into your page. If you prefer to include this as a separate JavaScript asset instead then you can define this in a yaml config (eg: mysite/_config/config.yml):

Axllent\LinksToBlank\LinksToBlank:
  inline: false