Skip to main content

Posts

Showing posts from July, 2018

Open Document Library documents in a new tab

Open Document Library documents in a new tab Set this scritp on the page or master page. <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js" ></script> <script> $ ( document ). ready ( function () { // has to be on an interval for grouped doc libraries // where the actual links are loaded only once a group // is expanded setInterval ( function () { $ ( "a[onclick*='return DispEx'][target!='_blank']" ) . attr ( "target" , "_blank" ) . removeAttr ( "onclick" ); // document type icons $ ( "td.ms-vb-icon>img[onclick]:not([documentUrl])" ) . click ( function ( e ) { window . open ( $ ( this ). attr ( "documentUrl" ), "_blank" ); e . stopPropagation (); e . preventDefault ();