I'm trying to see if there is a way to invoke the native contextual menu for a link in iOS Safari without requiring the user to do a long press.
(For example, if you open nytimes.com on your iPhone, and then long press on the first headline to open the system contextual menu, it will contain: Open Link, Open in New Tab, Copy Link, etc)
So we want to invoke THAT on our site WITHOUT requiring the user to press for 500ms. Ideally, the user can simply tap a button, but any alternative to long pressing would be acceptable (double tap, swipe, two-finger tap, etc.).
This effect is definitely possible inside of a native app with swift/obj-c. That is not what I'm looking for. I'm trying to achieve this specifically on our website when opened in Safari on iOS.
I've already tried:
1— seeing if there is a way to reduce the long-press time requirement. While it's possible to disable entirely with -webkit-touch-callout, we've found no way to reduce the time. Solutions on the internet that refer to variable long-press time delay thresholds all utilize third-party libraries to create non-native long-press behaviors, like pressing a button to make it 'jiggle'.
2— seeing if there is a way to ignore touchend event — so in other words, the user would tap (~10ms) and this would start a timer, and 490ms later the callout menu appears, long after the user has removed her finger. No luck with this either but seems like the most promising approach.
3— we also tried other, less ideal solutions where, for example, the user double taps — first on a transparent element, then on the main button. No luck with that either.
Any suggestions (or complete solutions!) would be greatly appreciated!
As i understand it, you open your application with webframe and you want to change a property that IOS has. I think you cant change this property with javascript or css. you should make a method that does this job with swift/obj-c, then you should consider triggering it via javascript.