I have a button which is supposed to trigger a custom behaviour. Therefore I am using Jquery's contextmenu event. Please see my fiddle.
Currently I am binding the event this way:
$( "#mybutton" ).contextmenu(function() {
alert( "Handler for .contextmenu() called." );
});
I also tried to bind it like this:
$( "#mybutton" ).on('contextmenu', function() {
alert( "Handler for .contextmenu() called." );
});
As you will see in my fiddle I disabled the default ios behaviour for longpress by using:
body { -webkit-touch-callout: none !important; }
input { -webkit-user-select: none !important; }
I tested my fiddle in:
- Chrome, latest version on windows (using right-click and touch)
- Chrome on Android using taphold
- Internet Explorer, latest version on windows (using right-click and touch)
- Opera, latest version on windows (using right-click and touch)
- Firefox, latest version on windows (using right-click and touch)
- Safari, on macOS Sierra, (using right-click)
All of the above work as expected. Unfortunately, this does not work on ios/Safari on my Ipad. The current Safari version is 10.1.2
I tried to debug this by connecting the Ipad to my mac and logging console output. It seems the event is never fired.
I already looked for solutions but unfortunately, the only solutions seem to be either using jquery-mobile's taphold which I want to avoid or writing a custom timer-based event handlers which is also not a very clean solution, imho.
Has anyone had a similar experience and maybe found a solution?