SharePoint2013 文档库里在新选项卡打开文件

在文档库插入script editor 部件,在部件插入如下代码即可:

$(document).ready(

    function () {

       setInterval(

    function () {

        $("a[onclick*='return DispEx'][target!='_blank']").attr("target", "_blank").removeAttr("onclick");

        $("td.ms-vb-icon>img[onclick]:not([documentUrl])").click(function (e) {

            window.open($(this).attr("documentUrl"), "_blank");

            e.stopPropagation();

            e.preventDefault();

            returnfalse;

        }).each(function () {

            $(this).attr("documentUrl", $.trim(String($(this).attr("onclick")).split("=")[1].replace(/["'{}]/g, "").split(";")[0]));

            this.onclick = null;

        });

    }, 500);

    }

);

 

参考:http://blog.csdn.net/chenxinxian/article/details/38319971

posted @ 2016-07-12 17:05  QQVV  阅读(182)  评论(0)    收藏  举报