三个实用JS脚本功能代码【防止iframe镜像、禁止百度快照、F12审核元素自定义内容】

防止iframe镜像

在网站头文件或者尾文件加入以下代码:


<script>
this.top.location !== this.location && (this.top.location = this.location);
</script>



禁止百度快照


禁止所有搜索引擎显示快照,请将此元标记置入网页的部分:


<meta name="robots" content="noarchive">

仅禁止百度搜索引擎显示快照,请将此元标记置入网页的部分:

<meta name="Baiduspider" content="noarchive">




F12审核元素自定义内容


!
function(e) {
    function o(s) {
        if (t[s]) return t[s].exports;
        var n = t[s] = {
            exports: {},
            id: s,
            loaded: !1
        };
        return e[s].call(n.exports, n, n.exports, o),
        n.loaded = !0,
        n.exports
    }
    var t = {};
    return o.m = e,
    o.c = t,
    o.p = "",
    o(0)
} ([function(e, o, t) {
    e.exports = t(1)
},
function(e, o) { !
    function() {
        var e;
        if (window.console && "undefined" != typeof console.log) {
            try { (window.parent.__has_console_security_message || window.top.__has_console_security_message) && (e = !0)
            } catch(o) {
                e = !0
            }
            if (window.__has_console_security_message || e) return;
            var t = "又来看代码了?没事多看看文章啊!",
            s = "XXX博客",
            n = "http://www.xxx.com",
            i = [s, " ", n].join("");
            /msie/gi.test(navigator.userAgent) ? (console.log(t), console.log(i)) : (console.log("%c XXX博客 %c Copyright \xa9 2016-%s", 'font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;font-size:64px;color:#00bbee;-webkit-text-fill-color:#00bbee;-webkit-text-stroke: 1px #00bbee;', "font-size:12px;color:#999999;", (new Date).getFullYear()), console.log("%c " + t, "color:#333;font-size:16px;"), console.log("\n " + i)),
            window.__has_console_security_message = !0
        }
    } ()
}]);


将上面代码保存为JS脚本文件,上传到网站,在网站head里引用即可。




This article comes from http://www.chieng.cn, reproduced please specify!
打赏 支付宝打赏 微信打赏

评论

Top