Important changes to Tiny Cloud pricing > Find out more

NOTE: TinyMCE 5 reached End of Support in April 2023. No more bug fixes, security updates, or new features will be introduced to TinyMCE 5. We recommend you upgrade to TinyMCE 6 or consider TinyMCE 5 Long Term Support (LTS) if you need more time.

Autolink plugin

Automatically create hyperlinks.

Contribute to this page

The Autolink plugin automatically creates hyperlinks when a user types a valid, complete URL. For example www.example.com is converted to http://www.example.com.

Note that this option won’t convert incomplete URLs. For example example.com would remain as unlinked text and URLs must include www to be automatically converted.

Note: Pasted URLs are automatically converted to a elements by TinyMCE’s core code, not by the autolink plugin. Therefore, behaviour and settings described here do not apply to pasted links.

Basic setup

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  plugins: 'autolink'
});

Options

default_link_target

This option allows you to set a default target value for links when inserting/editing a link via the link dialog. If the value of default_link_target matches a value specified by the target_list option, that item will be set as the default item for the targets dropdown in the link dialog.

Note: This option also applies to the autolink plugin.

Type: String

Example: Using default_link_target

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  plugins: 'link',
  menubar: 'insert',
  toolbar: 'link',
  default_link_target: '_blank'
});

link_default_protocol

This option allows you to set a default protocol for links when inserting/editing a link via the link dialog. The protocol will apply to any links where the protocol has not been specified and the prefix prompt has been accepted.

Note: This option also applies to the autolink plugin.

Type: String

Default Value: 'http'

Example: Using link_default_protocol

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  plugins: 'link',
  menubar: 'insert',
  toolbar: 'link',
  link_default_protocol: 'https'
});

Can't find what you're looking for? Let us know.

Except as otherwise noted, the content of this page is licensed under the Creative Commons BY-NC-SA 3.0 License, and code samples are licensed under the Apache 2.0 License.