掲示板
How to disable copy and paste feature from my pages
11年前 に Marcos Pereira によって更新されました。
How to disable copy and paste feature from my pages
New Member 投稿: 1 参加年月日: 12/10/31 最新の投稿
Hello.
I would like to know if there is a possibility of disabling the copy and paste features from only some of my content?
Thank you.
I would like to know if there is a possibility of disabling the copy and paste features from only some of my content?
Thank you.
11年前 に André Bunse によって更新されました。
RE: How to disable copy and paste feature from my pages
Junior Member 投稿: 85 参加年月日: 12/03/16 最新の投稿
You can disable copy and paste by binding "selectstart" and/or "mousedown" event on the underlying element of your content.
An easy way is using jQuery, than you can say:
the easiest way is using jQuery UI ;)
to handle the events with pure javascript there is much more to do, especially if you want to be cross-browser compatible
HTH
André
An easy way is using jQuery, than you can say:
jQuery("#myContent").bind("selectstart mousedown", function(event) {
event.preventDefault();
});
the easiest way is using jQuery UI ;)
jQuery("#myContent").disableSelection();
to handle the events with pure javascript there is much more to do, especially if you want to be cross-browser compatible
HTH
André
11年前 に Pavel Savinov によって更新されました。
RE: How to disable copy and paste feature from my pages
Junior Member 投稿: 94 参加年月日: 12/09/24 最新の投稿
There is no need to prevent selection or mouse-down. JQuery allows to block particular events, like this:
jQuery(document).ready(function () {
jQuery("#DivToPreventCopyPaste").bind("copy paste", false);
});
11年前 に Prabhakar Singh によって更新されました。
RE: How to disable copy and paste feature from my pages
New Member 投稿: 8 参加年月日: 12/08/02 最新の投稿
hey marcos ,
just try this line of code..it worked for me as i wanted to Disable copy and paste from one of my portlet page (which included a Registration Form)..!!
all you need to do is include these two lines of javascript code-
<script type="text/javascript">
document.oncopy=new Function("return false"); //Disable Copy using Javascript
document.onpaste = new Function("return false"); //Disable Paste using Javascript
</script>
just try this line of code..it worked for me as i wanted to Disable copy and paste from one of my portlet page (which included a Registration Form)..!!
all you need to do is include these two lines of javascript code-
<script type="text/javascript">
document.oncopy=new Function("return false"); //Disable Copy using Javascript
document.onpaste = new Function("return false"); //Disable Paste using Javascript
</script>
11年前 に Hitoshi Ozawa によって更新されました。
RE: How to disable copy and paste feature from my pages
Liferay Legend 投稿: 7942 参加年月日: 10/03/24 最新の投稿
Users will still be able to download the source and just copy and paste the content in the local copy. :-)
11年前 に Hitoshi Ozawa によって更新されました。
RE: How to disable copy and paste feature from my pages
Liferay Legend 投稿: 7942 参加年月日: 10/03/24 最新の投稿
Had a similar requirement.
I've converted text to images which I've uploaded to Documents and Media library with permission and I've also disabled context menu on view pages for regular users.
I've converted text to images which I've uploaded to Documents and Media library with permission and I've also disabled context menu on view pages for regular users.