Add A Reference To The Source In The Buffer When Copying | pure copyright


A vanilla JavaScript version of the jQuery Copyright Plugin that automatically appends a reference link or copyright text to user-copied content (copy to clipboard) on your web page.


You can pass an options object in the plugin init method.

  • text : The text that will be added when copying (Default: "<br>Original: " + window.location.href);
  • minlength : The minimum length of the copied text when running the plugin (Default: 0).
  • processing : Function to process the copied text (Default: undefined).

How to make use of it:

Install it via NPM:

$ npm install pure-copyright

1. Import the Copyright.js file into your web project.

import Copyright from 'pure-copyright'
<script src="dist/pure-copyright.js"></script>

2. Automatically append the title of the current page to your text when copied.

new Copyright(document.body)

3. Customize copyright text:

new Copyright(document.body, {
    text: "Your Copyright Text Here"

4. Set the minimum length of the copied text when running.

new Copyright(document.body, {
    minlength: 100

5. The copied text processing function.

new Copyright(document.body, {
    processing: function (text) {

6. Event.

new Copyright(document.body)
.on('beforeCopy', () => {
  console.log(+ new Date())
}).on('afterCopy', () => {
  console.log(+ new Date())

Add Reference And Copyright Text To Copied Content, pure-copyright Plugin/Github

See Demo And Download

Official Website(sinchang): Click Here

This superior jQuery/javascript plugin is developed by sinchang. For extra advanced usage, please go to the official website.