Javascript 为什么谷歌chrome手机浏览器没有用我的代码打开一个新标签?

Javascript 为什么谷歌chrome手机浏览器没有用我的代码打开一个新标签?,javascript,android,jquery,google-chrome,browser,Javascript,Android,Jquery,Google Chrome,Browser,单击test时,我的代码将打开一个新选项卡 我在我的电脑浏览器上测试了它,它运行良好,但当我在 谷歌chrome手机浏览器,它没有打开新标签,我该怎么做 <html> <head> <script> function makePopunder(pUrl) { var _parent = (top != self && typeof (top["document"]["location"].toString()) === "string"

单击
test
时,我的代码将打开一个新选项卡

我在我的电脑浏览器上测试了它,它运行良好,但当我在 谷歌chrome手机浏览器,它没有打开新标签,我该怎么做

<html>
<head>
<script>
function makePopunder(pUrl) {
    var _parent = (top != self && typeof (top["document"]["location"].toString()) === "string") ? top : self;
    var mypopunder = null;
    var pName = (Math["floor"]((Math["random"]() * 1000) + 1));
    var pWidth = window["innerWidth"];
    var pHeight = window["innerHeight"];
    var pPosX = window["screenX"];
    var pPosY = window["screenY"];
    var pWait = 3600;
    pWait = (pWait * 1000);
    var pCap = 50000;
    var todayPops = 0;
    var cookie = "_.mypopunder";
    var browser = function () {
        var n = navigator["userAgent"]["toLowerCase"]();
        var b = {
            webkit: /webkit/ ["test"](n),
            mozilla: (/mozilla/ ["test"](n)) && (!/(compatible|webkit)/ ["test"](n)),
            chrome: /chrome/ ["test"](n),
            msie: (/msie/ ["test"](n)) && (!/opera/ ["test"](n)),
            firefox: /firefox/ ["test"](n),
            safari: (/safari/ ["test"](n) && !(/chrome/ ["test"](n))),
            opera: /opera/ ["test"](n)
        };
        b["version"] = (b["safari"]) ? (n["match"](/.+(?:ri)[\\/: ]([\\d.]+)/) || [])[1] : (n["match"](/.+(?:ox|me|ra|ie)[\\/: ]([\\d.]+)/) || [])[1];
        return b;
    }();

    function isCapped() {
        try {
            todayPops = Math["floor"](document["cookie"]["split"](cookie + "Cap=")[1]["split"](";")[0]);
        } catch (err) {};
        return (pCap <= todayPops || document["cookie"]["indexOf"](cookie + "=") !== -1);
    };

    function doPopunder(pUrl, pName, pWidth, pHeight, pPosX, pPosY) {
        if (isCapped()) {
            return;
        };
        var sOptions = "toolbar=no,scrollbars=yes,location=yes,statusbar=yes,menubar=no,resizable=1,width=" + pWidth.toString() + ",height=" + pHeight.toString() + ",screenX=" + pPosX + ",screenY=" + pPosY;
        document["onclick"] = function (e) {
            if (isCapped() || window["pop_clicked"] == 1 || pop_isRightButtonClicked(e)) {
                //return;
            };
            window["pop_clicked"] = 1;
            mypopunder = _parent["window"]["open"](pUrl, pName, sOptions);
            if (mypopunder) {
                var now = new Date();
                document["cookie"] = cookie + "=1;expires=" + new Date(now["setTime"](now["getTime"]() + pWait))["toGMTString"]() + ";path=/";
                now = new Date();
                document["cookie"] = cookie + "Cap=" + (todayPops + 1) + ";expires=" + new Date(now["setTime"](now["getTime"]() + (84600 * 1000)))["toGMTString"]() + ";path=/";
                pop2under();
            };
        };
    };

    function pop2under() {
        try {
            mypopunder["blur"]();
            mypopunder["opener"]["window"]["focus"]();
            window["self"]["window"]["blur"]();
            window["focus"]();
            if (browser["firefox"]) {
                openCloseWindow();
            };
            if (browser["webkit"]) {
                openCloseTab();
            };
        } catch (e) {};
    };

    function openCloseWindow() {
        var ghost = window["open"]("about:blank");
        ghost["focus"]();
        ghost["close"]();
    };

    function openCloseTab() {
        var ghost = document["createElement"]("a");
        ghost["href"] = "about:blank";
        ghost["target"] = "PopHelper";
        document["getElementsByTagName"]("body")[0]["appendChild"](ghost);
        ghost["parentNode"]["removeChild"](ghost);
        var clk = document["createEvent"]("MouseEvents");
        clk["initMouseEvent"]("click", true, true, window, 0, 0, 0, 0, 0, true, false, false, true, 0, null);
        ghost["dispatchEvent"](clk);
        window["open"]("about:blank", "PopHelper")["close"]();
    };

    function pop_isRightButtonClicked(e) {
        var rightclick = false;
        e = e || window["event"];
        if (e["which"]) {
            rightclick = (e["which"] == 3);
        } else {
            if (e["button"]) {
                rightclick = (e["button"] == 2);
            };
        };
        return rightclick;
    };
    if (isCapped()) {
        return;
    } else {
        doPopunder(pUrl, pName, pWidth, pHeight, pPosX, pPosY);
    };
}


//makePopunder("http://www.yourdomain.com/");
</script>


</head>
<body>
    <dvi onclick="makePopunder('http://www.yourdomain.com/')">test</dvi>
</body>

函数makePopunder(pUrl){
var_parent=(top!=self&&typeof(top[“document”][“location”].toString())==“string”)?top:self;
var mypopunder=null;
var pName=(数学[“地板]((数学[“随机”]()*1000)+1));
var pWidth=窗口[“内部宽度”];
var pHeight=窗口[“内部高度”];
var pPosX=窗口[“屏幕X”];
var pPosY=窗口[“屏幕”];
var pWait=3600;
pWait=(pWait*1000);
var-pCap=50000;
var todayPops=0;
var cookie=“\uu.mypopunder”;
var browser=函数(){
var n=navigator[“userAgent”][“toLowerCase”]();
变量b={
webkit:/webkit/[“测试”](n),
mozilla:(/mozilla/[“测试”](n))&&(!/(兼容的webkit)/[“测试”](n)),
chrome:/chrome/[“测试”](n),
msie:(/msie/[“测试”](n))&&(!/opera/[“测试”](n)),
firefox:/firefox/[“测试”](n),
safari:(/safari/[“测试”](n)和&!(/chrome/[“测试”](n)),
opera:/opera/[“测试”](n)
};
b[“版本”]=(b[“狩猎”]?(n[“匹配”](/。+(?:ri)[\\/:]([\\d.]+)/)|[]):(n[“匹配”](/。+(?:ox | me | ra | ie)[\\/:]([\\d.]+)/)| |[])[1];
返回b;
}();
函数isCapped(){
试一试{
todayPops=Math[“floor”](文档[“cookie”][“split”](cookie+“Cap=”)[1][“split”](“;”)[0]);
}捕获(错误){};

return(pCap)您是否在移动Google Chrome中检查了浏览器识别的结果?它可能会识别为不正确的结果为什么要在mypopunder[“opener”][“window”][“focus”]()
下而不是在mypopunder.opener.window.focus()下执行