限制用户复制asp页面内容 [英] restrict user to copy asp page content

查看:73
本文介绍了限制用户复制asp页面内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Developer,

i有一个asp页面我想限制用户不要复制其内容。

为此我在JavaScript中使用了一些代码:



document.oncontextmenu = function(){return false;};

document.onselectstart = function(){return false;};



它适用于我不使用CSS的页面非常好。如果一个页面正在使用CSS,那么它只适用于某些TD标签,我不会应用任何CSS。



建议我,以便我可以限制用户复制任何我的asp页面中的内容...





先谢谢你...

Hello Developer,
i have a asp page in which i want to restrict user to not to copy its content.
For that i am using some code inside JavaScript :

document.oncontextmenu = function(){return false;};
document.onselectstart= function() {return false;};

it works very fine with pages in which i do not apply CSS. If a page is using CSS then it works only with in some TD tag where i do not apply any CSS.

Suggest me so that i can restrict user to copy any content in my asp page...


Thanks in Advance...

推荐答案

如果我理解正确,你可以使用 user-select CSS3 属性...

HTML:

If i understood it correctly, You can use user-select CSS3 property...
HTML:
<span class="protected">Datas you wants protect</span>



CSS:


CSS :

.protected {
    -moz-user-select:none;
    -webkit-user-select:none;
    user-select:none;
}


document.oncontextmenu = function(){return false;};

document.onselectstart = function (){return false;};





使用正确的CSS样式文件
document.oncontextmenu = function(){return false;};
document.onselectstart= function() {return false;};


With right CSS Style file


这篇关于限制用户复制asp页面内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆