Datatables Link in iOS Webapp

Datatables Link in iOS Webapp

b0xCHb0xCH Posts: 2Questions: 1Answers: 1
edited March 2017 in Free community support

Heyo!

I'm using Datatables inside an iOS webapp.
To prevent following "a href"-links opening in a new tab I'm using this script:

`//Webapp Fix

    if (("standalone" in window.navigator) && window.navigator.standalone) {
      $('a').on('click', function(e){
        e.preventDefault();
        var new_location = $(this).attr('href');
        if (new_location != undefined && new_location.substr(0, 1) != '#' && $(this).attr('data-method') == undefined){
          window.location = new_location;
        }
      });
    }`

This works perfectly fine, even on DataTables.. IF it is on the first page.
Whenever I use the DataTables-pageswitcher (Below the table.. 1, 2, 3...) it will begin to open all links outside the webapp. This is wrong.

There are other ways to prevent the webapp to open Links in a new Safari window, but most of them will kill onClick, which is not an option for me.

Any help?

Thanks, Jan

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.