Mobile app version of vmapp.org
Login or Join
Alves908

: How to allow selecting texts on the posts that are disabled from selecting? Let me make clear. I added a html/javascript code on my blogger for disabling copying of contents. The code is :

@Alves908

Posted in: #Blogger #Javascript

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 :)

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Alves908

2 Comments

Sorted by latest first Latest Oldest Best

 

@Chiappetta492

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%;
}

10% popularity Vote Up Vote Down


 

@Gonzalez347

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme