美文网首页
js执行跳转url,兼容所有浏览器

js执行跳转url,兼容所有浏览器

作者: 湛都南 | 来源:发表于2018-12-29 19:23 被阅读0次

function doLocation(url) {

    var a = document.createElement("a");

    if (!a.click)

    {

        window.location = url;

        return;

    }

    a.setAttribute("href", url);

    a.style.display = "none";

    document.body.appendChild(a);

    a.click();

}

相关文章

网友评论

      本文标题:js执行跳转url,兼容所有浏览器

      本文链接:https://www.haomeiwen.com/subject/tdbplqtx.html