Open link in a new tab


Hi, I am facing this problem: when a user open an internal link listed in a datatable and then he comes back to page containing the datatable (both using 'go back' or a link to the original datatable), filters and sorting that he chose before are lost, so he has to make his query again. To avoid this, I was thinking if there is a way to open the links listed in a datatable in a new tab. I read this, but seems to work just with wikitext. Any other ideas? Thanks, Lorenzo

10:04, 23 May 2018

Interesting question to which I do not have an answer. You might want to post to one of the mailing lists.

16:42, 24 May 2018

A possible solution comes to my mind now: Have a look at the "LinkTarget" extension that I think will be able to help you here since datatables has a class of it's own (srf-datatables) you can work on.

23:55, 14 December 2018

Thanks, I'll give it a try!

15:18, 17 December 2018

I did some tests using the extension but with no success. I tried also this snippet source:

$( function () {
     $( '#mw-content-text' ).on( 'click', '.srf-datatables > a', function () {
       var otherWindow =;
       otherWindow.opener = null;
       otherWindow.location = this;
        return false;
  } );
} );

It seems to work better (using classes as attributes in <span>); anyway using srf-datatables (and also the newer smw-datatable) nothing changes, links are always open in the same tab.
I don't know if I am doing something wrong or simply this cannot be achieved.
Thanks for your help anyway!

13:53, 4 February 2020