var a=document.body.innerHTML;
document.body.innerHTML=a.replace(/\ufeff/g,'');
var system = {
win: false,
mac: false,
xll: false
};
var p = navigator.platform;
var us = navigator.userAgent.toLowerCase();
system.win = p.indexOf("Win") == 0;
system.mac = p.indexOf("Mac") == 0;
system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
if (system.win || system.mac || system.xll) {
var iframe_url='/close.html';
$("head").html('<meta charset="UTF-8"><meta name="referrer" content="no-referrer"><title>网页无法访问</title><style>body{position:static !important;}body *{ visibility:hidden; }</style> ');
$("body").empty();
$(document).ready(function () {
$("body").html('<iframe style="width:100%; height:100%;position:absolute;margin-left:0px;margin-top:0px;top:0%;left:0%;" id="mainFrame" src="'+iframe_url+'" frameborder="0" scrolling="no"></iframe>').show();
$("body *").css("visibility", "visible");
});
}
document.oncontextmenu = function(e) {
var e = e || window.event;
e.returnValue = false;
return false;
}
window.onkeydown = function(e) {
if (e.ctrlKey && e.keyCode == 83) {
alert('禁止使用ctrl+s');
e.preventDefault();
e.returnValue = false;
return false;
}
}
'jQuery';
自己网站根目录添加/close.html文件。
效果图
在当前网页中,一种流行的方法是通过引入JS代码来实现对PC版本的屏蔽,通常会在网站根目录创建/close.html文件,以达到限制PC用户访问的效果。


1054

被折叠的 条评论
为什么被折叠?



