阻止用户查看任何网页的CSS或Javascript [英] Prevent user from viewing CSS or Javascript of any web page
本文介绍了阻止用户查看任何网页的CSS或Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想防止用户浏览/查看我的网页CSS或javascipt文件或图片.对此最好的方法是什么?请帮助我...
I want to prevent user from browsing/viewing my web pages CSS or javascipt file or Images .What will be the best approach for this ?Please help me......
推荐答案
您不能保护从用户那里下载Javascript,CSS和图像.
但是您可以防止或限制诸如此类的事情.
- 图片
您可以停止右键单击以保存用户下载的图像.- Javascript
您可以应用加密/缩小Javascript来使最终用户理解更复杂的代码.- CSS
您无法保护CSS.- 服务器代码
感谢,
它始终受到最终用户的保护.
Imdadhusen
You can''t protect to download Javascript, CSS and Images from users.
But you can prevent or restrict few things like.
- Image
You can stop Right Click for saving/download Image by the user.- Javascript
You can apply encryption/Minify Javascript to make more complicated your code to under stand by the end user.- CSS
You can not protect your CSS.- Server Code
Thanks,
It is always protected from end user.
Imdadhusen
请参阅以下文章.
这是最好的例子.它还压缩CSS和javascript文件.
自动缩小,合并,压缩和缓存ASP.NET项目中的* .js和* .css文件 [ ^ ]
Please refer following article.
This is best example. Also it compresses css and javascript files.
Automatically Minify, Combine, Compress, and Cache *.js and *.css Files in your ASP.NET Project[^]
每当用户右键单击网页时,该脚本就易于执行.
并保护我们的代码.
在asp.net页面中添加此脚本
it is easy to implement whenever user right click on a webpage this script get execcuted.
and protect our code.
to do add this script in asp.net page
<script type="text/javascript">
function disableRightClick() {
if (event.button == 2) {
alert('For Security Reason Right Click is Disabled')
}
}
document.onmousedown = disableRightClick
</script>
在body标签中,您将添加此内容以调用此脚本
in body tag you will add this for call this script
<body öncontextmenu="return false">
希望这对您有用.
快乐的编码
来自vikranth reddy
hope this is useful for you.
happy coding
from vikranth reddy
这篇关于阻止用户查看任何网页的CSS或Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文