如何从视图代码/检查元素浏览器隐藏表单代码? [英] How to hide form code from view code/inspect element browser?

查看:97
本文介绍了如何从视图代码/检查元素浏览器隐藏表单代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是我的代码,请参阅下面的内容:

 < div style =text-align:center; padding:300px; font-family:lato;> 
请稍候重定向页面......< br>
< img src =http://maps.nrel.gov/sites/all/modules/custom_modules/hydra/assets/images/loading_bar.gifborder =0>
< / div>


< input type =hiddenname =id_cradvalue =...>
< input type =hiddenname =currency_codevalue =USD>
< input type =hiddenname =amountvalue =12.99>
< / form>


< script type =text / javascript>
setTimeout(function(){f1.submit();},3000);
< / script>

请参阅

解决方案

<有一个聪明的方法来禁用您的网站中的检查元素。只需在脚本标记中添加以下片段即可:

  $(document).bind(contextmenu,function(e){
e.preventDefault();
});

请查看博客



直接从浏览器取得检查元素的功能键F12,我们还可以通过使用以下代码来禁用它:

  $(document).keydown(function(e){
if(e.which === 123){
return false;
}
});


I want to hide form code from view code/inspect element browser , how can i do that ?

This is my code, please see below:

<div style=" text-align: center;  padding: 300px; font-family: lato; ">
     Please wait redirect page ......<br>
    <img src="http://maps.nrel.gov/sites/all/modules/custom_modules/hydra/assets/images/loading_bar.gif" border="0">
</div>


<form name="f1" action="payments.php" method="post">
<input type="hidden" name="id_crad" value="...">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="amount" value="12.99">
</form>


<script type="text/javascript">
setTimeout(function(){f1.submit();}, 3000);
</script>

Please see picture

解决方案

There is a smart way to disable inspect element in your website. Just add the following snippet inside script tag :

$(document).bind("contextmenu",function(e) {
 e.preventDefault();
});

Please check out this blog

The function key F12 which directly take inspect element from browser, we can also disable it, by using the following code:

$(document).keydown(function(e){
    if(e.which === 123){
       return false;
    }
});

这篇关于如何从视图代码/检查元素浏览器隐藏表单代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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