Note that there are some explanatory texts on larger screens.

plurals
  1. PODisabling default drag behavior on links in iOS Safari
    primarykey
    data
    text
    <p>I am developing a web app. I am trying to disable most of the default iOS Safari behavior on links so I set the "-webkit-touch-callout" CSS property on the links to "none". However, I still notice that if I hold my finger on a link for a second or so, then drag it, then let go of it, the link will open in a new window. I don't want this behavior. I would like it to either open in the same window, or do nothing at all. Does anyone know how to make this happen?</p> <p><strong>EDIT:</strong> I am using jQuery so it is OK to use jQuery's event-handling functions if that will simplify things.</p> <p><strong>EDIT 2:</strong> For some links, I am using handlers to override their default behavior. For example: </p> <pre><code>$(".categoryList a").live("click", function(e) { e.preventDefault(); $.get( "someOtherUrl", {someVariable: "someValue"}, function(result) { $(".result").html(render(result)); } ); }); </code></pre> <p>My actual code is more complicated than this but my point is that I am overriding the default click action on some links and <strong>whatever solution I use to fix this problem should not interfere with these handlers</strong>. Sanooj's solution does not work for my purposes because the "window.location" assignment always redirects the browser regardless of whether I have any handlers to prevent this behavior. Maybe I arguably shouldn't use links for this purpose but this is how the app was before I started working on it and changing this would be a big project. I am wondering if there is an easier and simpler way to fix this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload