I am developing a web application. I am trying to disable most of the default iOS Safari behavior for links, so I set the CSS property "-webkit-touch-callout" in the links to "none". However, I still notice that if I swipe the link for a second or so, drag it and then release it, and the link will open in a new window. I do not want this behavior. I would like it to either open in the same window or do nothing. Does anyone know how to do this?
EDIT: I use jQuery, so itβs quite normal to use jQuery event handling functions if this makes things easier.
EDIT 2: For some links, I use handlers to override their default behavior. For instance:
$(".categoryList a").live("click", function(e) { e.preventDefault(); $.get( "someOtherUrl", {someVariable: "someValue"}, function(result) { $(".result").html(render(result)); } ); });
My actual code is more complex than this, but I want to say that I am redefining the default action for clicks on some links and any solution that I use to fix this problem should not interfere with these handlers . Sanooj's solution does not work for my purposes, because assigning "window.location" always redirects the browser, regardless of whether I have handlers to prevent this behavior. Maybe I might not have to use links for this purpose, but that was before I started working on it, and changing that would be a great project. I am wondering if there is a simpler and easier way to fix this.
source share