zoukankan      html  css  js  c++  java
  • 突破防盗链Referrer

    //引用的源码网站的js
    <script src="https://raw.githack.com/jpgerek/referrer-killer/master/referrer-killer.js"></script>
    //页面中所有img都会被加入到iframe中
    jQuery("div").find("img").each(function() {
    var img = jQuery(this);
    var img_src = img.attr("src");
    if (img_src != undefined && img_src != '') {
    img_src = decodeURI(img_src);
    img_src = img_src.split("?")[0];
    //图片地址后缀
    if (img_src.indexOf("qpic.cn") > 0 || img_src.indexOf("qlogo.cn") > 0 || img_src.indexOf("qq.com") > 0 ||
    img_src.indexOf("upaiyun.com") > 0) {
    var frameid = 'frameimg' + Math.random();
    img.parent().attr("id", frameid);
    img.remove();
    document.getElementById(frameid).innerHTML = ReferrerKiller.imageHtml(img_src);
    console.log("1")
    $(document.getElementById(frameid).children).css({
    "width": "auto",
    "min-width": "-webkit-fill-available",
    "height": "450px",
    "min-height": "auto"
    });
    $(document.getElementById(frameid).children).contents().find("img").css({
    "width": "auto",
    "min-width": "auto",
    "height": "450px",
    "min-height": "auto"
    });
    }
    }
    });

    页面例子
    <div class="layui-carousel" id="test1">
    <div carousel-item>
    <div><img src="https://hbimg.b0.upaiyun.com/4b5933e46f9f7b6ef76fdfa5ecc5bfc439303018155304-gjCZyE"></div>
    <div><img src="https://hbimg.b0.upaiyun.com/4b5933e46f9f7b6ef76fdfa5ecc5bfc439303018155304-gjCZyE"></div>
    <div><img src="https://hbimg.b0.upaiyun.com/361b360c163c5572060bb6c5de7cf7c52204d9bd16cf18-KJBpWH"></div>
    <div><img src="https://hbimg.b0.upaiyun.com/40c4c7719f45a1a58a3dbd82b4bbea6b00ffb849d2948-BwV4Fu"></div>
    </div>
    </div>

  • 相关阅读:
    268. Missing Number
    217. Contains Duplicate
    189. Rotate Array
    Two Sum II
    122. Best Time to Buy and Sell Stock II
    169. Majority Element
    C# ConfigurationManager不存在问题解决
    C# sqlhelper
    C#基础
    数据库事务日志已满的解决办法
  • 原文地址:https://www.cnblogs.com/yu-du-chen/p/10716073.html
Copyright © 2011-2022 走看看