分享一套前端屏蔽代码---禁止鼠标右键菜单 屏蔽复制 禁止F12~
<script> $(function () { document.onkeydown = function (e){ var theEvent = window.event || e; var code = theEvent.keyCode || theEvent.which; if(code == 123){ return false; } } //屏蔽F12 document.oncontextmenu = function (event){ if(window.event){ event = window.event; }try{ var the = event.srcElement; if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){ return false; } return true; }catch (e){ return false; } }//屏蔽右键菜单 document.oncopy = function (event){ if(window.event){ event = window.event; }try{ var the = event.srcElement; if(!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){ return false; } return true; }catch (e){ return false; } }//屏蔽复制 }); // window.onload=function(){ // document.getElementById('iframe').contentDocument.onkeydown = function(ev){ // if(ev.keyCode == 123) { // alert("本站禁止此操作"); // return false; // } // } // } // domsg(); function domsg(company,mobile){ $.ajax({ url:'https://mfdemo.cn/consult', data:{company:company,mobile:mobile}, type:'post', dataType:'json', success:function(res){ console.log(res); } }) } </script>
发布评论