Datatables Link in iOS Webapp
Datatables Link in iOS Webapp
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
Fixed it by myself. If anyone has the same problem.. this helps:
https://gist.github.com/kylebarrow/1042026
Hi Jan,
Thanks for posting back. Good to hear you have it working.
Allan