0

Let me make clear. I added a html/javascript code on my blogger for disabling copying of contents. The code is :

<script src='demo-to-prevent-copy-paste-on-blogger_files/googleapis.js'></script><script type='text/javascript'> if(typeof document.onselectstart!="undefined" ) {document.onselectstart=new Function ("return false" ); } else{document.onmousedown=new Function ("return false" );document.onmouseup=new Function ("return false"); } </script>

So how can I allow selecting only some texts from the page? For Example if I want to provide some codes to my reader, how can I allow them just to copy the code but not the whole post?

Thanks in Advance :)

  • 2
    Why did you do that? Any specific reason? Disabling right click, text selection and similar tricks does nothing but annoy visitors. If someone wants to copy text then there are several other ways. – Robert hue Dec 31 '15 at 8:39
  • Nah! I am just asking. I saw this feature on <helplogger.blogspot.com/2015/07/…> . See? There you can't copy content but you can select and copy the codes. ;) – Prashant Poudel Dec 31 '15 at 10:39
  • 1
    In that case, it is better suitable for Stack Overflow – Robert hue Dec 31 '15 at 11:38
  • Okay!!! I'm heading there... – Prashant Poudel Dec 31 '15 at 12:22
  • 1
    Disabled copy and paste is about the most annoying thing after auto start of midi. If someone isn't willing to share stuff they post in a public domain then I move on to a different site. – Steve Jan 1 '16 at 1:57
1

To make some text selectable and some unselectable you have to add a script in your blog that will disable all click after that store your codes which you want to be selectable on google drive then embed them in your posts. Its the best way to do so. Though helplogger has done it but if an experienced person wants he can copy all the content of the page by developers tools of browser. The best way to protect your content is as i told. By the way this question shouldn't be in webmasters.

1

If something is on the internet, you can copy it. Don't think people won't copy your text, because if they want to, they will. If you don't want it copied, don't publish it.

  • Turn of javascript-> now I can copy
  • View source -> Ét voilá there it is
  • Take my console (Firebug), inspect element -> again, got everything I want

There are too many ways to do this.


Sort of solution:

Instead of the javascript, try an overlay with css. A lot simpeler, and this way at least the "turn javascript off" doesn't work.

.NoSelect{
    position: relative
}
.NoSelect:after{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.