safari target =“_ blank”和ajax

时间:2013-08-30 13:10:51

标签: javascript html ajax safari

我有以下HTML代码:

<a href="url.com" target="_blank" onclick="jsFunction1('var');jsFunction2();">image</a>

我有以下js函数:

var jsFunction = function(button) {
    var site = encodeURIComponent("site name");
    var lid = "lid";
    var src = "src";
    var pf = "platfrom";
    $.ajax({
        url: "https://www.myurl.com/page.php?site="+site+"&lid="+lid+"&src="+src+"&pf="+pf+"&bt="+button,
        async: false
    });
}

var jsFunction2 = function() {
    var lid = "lid";
    var offer = "offer";
    var platform = "platfrom";
    var site = encodeURIComponent("site name");
    var aid = "aid";
    var sid = encodeURIComponent("sid");
    var placement = "placement";
    $.ajax({
        url: "https://www.myurl.com/pagetwo.php?lid="+lid+"&offer="+offer+"&platform="+platform+"&site="+site+"&aid="+aid+"&sid="+sid+"&placement="+placement,
        async: false
    });   

    window.location = "mypage.php";
}

除了Safari 5.1.9及更高版本之外,这似乎在所有浏览器中都能正常运行。单击链接后,它会打开一个新的窗口/选项卡,父窗口将按预先指示。但是,在safari中,不会打开新窗口,但父窗口仍然向前移动。关于为什么safari有这种行为以及如何解决或修复它的任何想法?

0 个答案:

没有答案