Saturday, February 22, 2014

Add a copyright notice to text copied on your website or blog

Here's a quite smart trick for today: Add a Copyright Notice to Copied Text.

What it does is that when someone copies text from your blog or website, this script ensures that once the text is pasted, it adds the URL of your post (on a blog) or page (on a website for example) and a copyright notice to the end of the pasted text. How awesome is that, right? :)

6 comments:

  1. Hi there, do you happen to know if this is just a Wordpress thing? I've tried it with my Blogger blog with no luck, even after tweaking the copyright symbol (©) which Blogger doesn't seem to like in the header. Suggestions?

    ReplyDelete
    Replies
    1. Hi Kelly, good that you commented on this, as it looks like my implementation of this script was lost in translation when I applied this new, temporary template. I have now added it back and it works like a charm (you may want to give it a try), so not sure why it's breaking for you.

      As to the copyright symbol in the header, do you mean you believe that's what's causing the snippet to fail? Generally speaking I don't think it's Blogger that doesn't like the copyright symbol, it's rather the different interpretation of the different fonts and maybe even database entries, so you're better off using the HTML entity equivalents of special characters (© in case of the copyright symbol).

      What have you tried to implement this code on your Blogger blog?

      Delete
  2. Thanks for your quick reply! When I try to save the template changes, I get this error:

    Error parsing XML, line 1059, column 134: The entity "copy" was referenced, but not declared.

    I've tried using © instead of ©, which gets rid of the error, but still no luck.

    Ah, I just noticed, when I go back in, Blogger changes all of my " to &quote;. Maybe I'll try in a different browser (using Chrome currently).

    ReplyDelete
    Replies
    1. A different browser won't help you in there. What you're facing is probably caused by the way quotes are used in your code. Here is what I suggest you have (mind the quotes and the other characters, very important that you keep them this way):

      var pagelink = &quot;<br/><br/> Read more at: <a href='&quot;+document.location.href+&quot;'>&quot;+document.location.href+&quot;</a><br/>Copyright &amp;copy; webeno - webdesign, webhosting&quot;;

      Of course, replace the last part with the name of your side ;) Let me know if this works.

      Delete
    2. Actually, that does not paste very well into Blogger, so let me email you with the exact code...

      Delete