October 11, 2011 19

Add “Read more” links to text copied from your website

By . | Categories: JavaScript

In 2009, a company called Tynt introduced a free service whereby website owners can add a “Read More” link to the bottom of text copied from their web pages.

Utilising a simple JavaScript, the controversial copy-paste modification utility works as follows:

  1. A user highlights some text on a web page and copies it, either by pressing Ctrl + C or via the browser menu.
  2. The Tynt JavaScript records the text that has been copied and sends it to Tynt for analytical/statistical purposes on behalf of the website owner.
  3. The Tynt JavaScript adds a “Read more” link to the bottom of the clipboard buffer containing the page URL, plus a unique code. (For example: “Read more: http://code.adonline.id.au/add-read-more-links-to-copied-text/#ixzz1aSokO3X3″
  4. When the user pastes the text, the “Read more” link is appended to the end.
  5. If the copied text is inserted into an email or reposted on another website verbatim and people click on the link, data will be sent to Tynt tracking the re-published information.
  6. Tynt forwards usage data to the website owners, who gain a better understanding of what content visitors are interested in.

The Tynt service seems to be very popular with newspaper and publishing websites where plagiarism could be a concern.

Implementing a “Read more” script on your site

If you want site analytics, you can sign up with Tynt.

Otherwise you can set-up your own Tynt-style “Read more” script that doesn’t rely on third parties. This solution doesn’t provide analytics nor use Tynt code. Rather it’s a simple implementation that provides a “Read more” hyperlink at the bottom of text copied from your website.

Several scripts have been written to add this function to websites, but I have been unable to find one that works on both Internet Explorer and non-IE browsers.

The solution I have found is to add two scripts to each page; one for Internet Explorer and one for Firefox/Chrome/Safari/Opera. (Combining these scripts into a single .js file breaks functionality).

Step 1: Get jQuery

The script for use on Internet Explorer requires the jQuery JavaScript library. If your site isn’t using jQuery, download the latest minified ‘production’ script, upload it to your server and add the following link to your <head>.

<script type="text/javascript" src="http://www.yourwebsite.com/jquery.js"></script>

If your site already utilises jQuery, ignore this step.

Step 2: Download the JavaScript files

Unfortunately two scripts are required to provide function in Internet Explorer and non-IE browsers. They do work well in tandem:

You can download the scripts for use from their respective sites. To make things easier and ensure scripts load faster, I have minified them and bundled them into a single ZIP file which you can download here:

copytext.zip

Step 3: Site implementation

Unzip the file, and upload the two files to your website via FTP. Then ensure the following code is added to the page <head>:

<script type="text/javascript" src="http://www.yourwebsite.com/jquery.js"></script>
<script type="text/javascript" src="http://www.yourwebsite.com/jquery.copytext.min.js"></script> <!-- For Internet Explorer -->
<script type="text/javascript" src="http://www.yourwebsite.com/copytext.min.js"></script> <!-- For non-IE browsers -->

It’s essential that the reference to your jQuery script comes first.

Now when you copy and paste text from your website, you should see a “Read more” link at the bottom.

Tags: , , , , , , ,

19 Responses to “Add “Read more” links to text copied from your website”

  1. TestShoot says:

    Thanks Adam! I was looking for an alternative to Tynt, and this did the trick.

    The good news too is that for those enterprise people, you can add events and things like Omniture tags to the copy action. You can also break it out to add a special “read more” based on a content areas users may copy from. IE: for more recipes visit, learn more about the author at…

  2. mark82 says:

    i have just downloaded Copy & Paste Hijacker from jquery’s
    and seems to be crossbrowser, so there is no need to have two separate js!

  3. mark82 says:

    hi

    currently i have two computer.

    on mac it worked with safari, chrome and firefox.
    on windows7, i tried on internet explorer, chrome and firefox.

    i have tested it on demo page provided by plugin @ http://e.xplo.it/jquery/cp.html

  4. Adam Dimech says:

    Hello Mark,

    Having studied the code, it appears it has been modified since I wrote my blog post on 11 October 2011. I agree, it now works in IE9 and Firefox 7.

    • Jake Lanso says:

      Please update this post. The plugins page at jquery.com has been down for a couple months now.

      Could you please edit the plugin so that it works for IE9 And Firefox?

  5. msnz says:

    i downloaded the new Copy & Paste Hijacker but i dont now how to modify it.

  6. Santosh says:

    I am trying to use Tynt is my website.. Hope it will work fine for my blog..

  7. Ali says:

    I wish it was including images also (like when someone copied IMG url in your page.)

    And, I can’t find updated version of Copy & Paste Hijacker in jquery.com which mentioned by mark82. It’s a broken url. If you have that version, could you upload it here since IE code is not working nowadays.

    Thanks for nice post.

  8. Oliver says:

    It is probably sufficient to add

    charset=”iso-8859-1″

    when including jquery.copytext.min.js to make it work in everything but Opera.

  9. William says:

    Hey, great article. I have made something similar that you might like to check out. You can add anything you wish to the copied text, its a jQuery plugin found on code canyon.

    The link is: http://codecanyon.net/item/jquery-copy-inject/3537749?ref=awgeorge

  10. [...] Use a copy detection and attribution service like http://www.tynt.com or a script such as the ones created by Adam Dimech [...]

  11. [...] Use a copy detection and attribution service like http://www.tynt.com or a script such as the ones created by Adam Dimech [...]

  12. Kevin says:

    Although not a way to prevent people from copying your content, this code clearly makes people think twice before they do.

    Therefore, I’m seriously thinking about getting my webmasters to implement this on my own website.

    Thanks for sharing the tip.

  13. [...] Para los que se dedican a copiar contenidos de tu web puedes utilizar servicios como http://www.tynt.com o un scrip tales como los creados por Adam Dimech, aquí lo puedes encontrar. [...]

  14. supermario says:

    Script won’t work in IE 10

  15. [...] Use a copy detection and attribution service like http://www.tynt.com or a script such as the ones created by Adam Dimech [...]

Leave a Reply

HTML: Your comment may contain these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

(Comments will be published subject to the Editorial Policy).

Contact

Contact Adam Dimech

To contact me, please use the

Feedback Form

or send a message via the following social media:


Facebook Flickr GooglePlus Twitter