This page is outdated

You are reading documentation for Linkify v2. Browse the latest v3+ documentation.

Jump To

Installation/Getting Started

Download the latest release or install via NPM

npm install --no-optional linkifyjs

or Yarn

yarn add --ignore-optional linkifyjs

or Bower

bower install linkifyjs

Quick Start

Add linkify and linkify-jquery to your HTML following jQuery:

<script src=""></script>
<script src="linkify.min.js"></script>
<script src="linkify-jquery.min.js"></script>

Note: A polyfill is required for Internet Explorer 8.

    target: "_blank"

This behaviour is also available without jQuery via linkify-element.

linkify.find('Any links to here? If not, contact');

Returns the following array

    type: 'url',
    value: '',
    href: ''
    type: 'email',
    value: '',
    href: ''

See all available options


npm install linkifyjs
var linkify = require('linkifyjs');
var linkifyHtml = require('linkifyjs/html');
require('linkifyjs/plugins/hashtag')(linkify); // optional

or with ES6 modules

import * as linkify from 'linkifyjs';;
import linkifyHtml from 'linkifyjs/html';
import hashtag from 'linkifyjs/plugins/hashtag'; // optional


Example string usage

linkifyHtml('The site is #awesome.', {
  defaultProtocol: 'https'

Returns the following string

'The site <a href=""></a> is <a href="#awesome">#awesome</a>.'


<script src="r.js"></script>
<script src="linkify.amd.js"></script>
<script src="linkify-plugin-hashtag.amd.js"></script> <!-- optional -->
<script src="linkify-element.amd.js"></script>
require(['linkify'], function (linkify) {
  linkify.test(''); // true
  linkify.test('', 'email'); // false

require(['linkify-element'], function (linkifyElement) {

  // Linkify the #sidebar element
  linkifyElement(document.getElementById('sidebar'), {
    linkClass: 'my-link'

  // Linkify all paragraph tags


Note that if you are using linkify-jquery.amd.js, a jquery module must be defined.

Browser globals

<script src="jquery.js"></script>
<script src="linkify.js"></script>
<script src="linkify-string.js"></script>
<script src="linkify-jquery.js"></script>
linkify.test(''); // true
var htmlStr = linkifyStr('Check out it is great!');

Internet Explorer

Linkify natively supports Internet Explorer 9 and above. Internet Explorer 8 is unofficially supported with a polyfill.

You can use either es5-shim (sham also required) or the provided linkify-polyfill.js:

<script src="jquery.js"></script>

<!--[if IE 8]>
<script src="linkify-polyfill.js"></script>
<script src="linkify.js"></script>
<script src="linkify-jquery.js"></script>