html或Dotnet中的代码以隐藏视图源: [英] code in html or Dotnet to hid view-source:

查看:458
本文介绍了html或Dotnet中的代码以隐藏视图源:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

dotnet或html5中是否有任何Web应用程序可以隐藏我们网页中的源代码.

感谢

Is there any web-application in dotnet or in html5 which can hidd the source code in our web pages.

thanks

推荐答案

简短答案:否.

源必须存在,浏览器才能读取它,如果浏览器可以读取它,那么任何人都可以读取它.您可以使用Javascript使其变得更加棘手,但用户可以轻松关闭Javascript.
Short answer: No.

The source has to be there for the browser to read it, and if the browser can read it then anyone can read it. You can use Javascript to make it a bit more tricky, but the user can easily turn Javascript off.


如果输入正确,那么您只是想避免右键单击页面. /> 只需将此脚本粘贴到页面的标题标签上即可.

< script LANGUAGE ="JavaScript1.1">
<!-开始​​
功能权(e){
如果(navigator.appName ==``Netscape''&&
(e.哪个== 3 || e.哪个== 2))
返回false;
否则如果(navigator.appName ==``Microsoft Internet Explorer''&&
(event.button == 2 || event.button == 3)){
alert(对不起,您不能右键单击.");

返回false;
}
返回true;
}
document.onmousedown = right;
如果(document.layers)window.captureEvents(Event.MOUSEDOWN);
window.onmousedown = right;
//结束->
</script>

这样,您可以防止用户查看您的代码
希望对您有帮助....
If im right then u just want to avoid right click on your page..
just paste this script on your page''s header tag..

<script LANGUAGE="JavaScript1.1">
<!-- Begin
function right(e) {
if (navigator.appName == ''Netscape'' &&
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == ''Microsoft Internet Explorer'' &&
(event.button == 2 || event.button == 3)) {
alert("Sorry, you are not allowed to right click.");

return false;
}
return true;
}
document.onmousedown=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right;
// End -->
</script>

this way, u can prevent user from viewing your code
hope this help u....


我已将此代码用作解决我的问题的方法

< script type ="text/javascript">
document.oncontextmenu = new Function("return false");
</script>

但是在谷歌搜索期间,我在mozilla网站上看到一个门户网站,他们已将同一页面重定向到view-source:xxxxxxxxxxx,并且正在显示设计页面的代码.谁能告诉我差不多.抱歉,我忘记记下页面的网址.
I have used this code as a solution for my problem

<script type="text/javascript">
document.oncontextmenu=new Function("return false");
</script>

but during googling i saw a portal on mozilla website that they had redirected the same page to view-source:xxxxxxxxxxx and that was showing the design page instid of code. could any one ca ltell me about the same. sorry i forgot to note the url of the page..


这篇关于html或Dotnet中的代码以隐藏视图源:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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