Coding Thoughts
-
Hi Keith
Thank you for making this plugin. I had been using your old code, version 2.2 I think, when I realized you could still save with a long hold (mobile right click) in iOS.
I updated to your current code and it does have a couple of issues so I started digging in.
It seems the desktop code works for everything but iOS, so disabling the following with preventDefault works across desktops, Android and Windows mobile I think:
document.addEventListener(‘mousedown’, disableEvent);
document.addEventListener(‘contextmenu’, disableEvent);
document.addEventListener(‘copy’, disableEvent);
document.addEventListener(‘cut’, disableEvent);The problem starts with iOS in my experience, it does not support the above non touch screen defaults and instead everything is done through the touch event. As soon as we mess with the touch event it breaks clicking, scrolling etc.
I dug and dug and found this:
https://stackoverflow.com/questions/12304012/preventing-default-context-menu-on-longpress-longclick-in-mobile-safari-ipadand have tried and tested code using it where I apply the following css to images:
-webkit-touch-callout: none;
-webkit-user-select: none;it blocks the iOS context menu!
Currently I am testing code still, but I am combining javascript preventDefault on desktop events with the css code above and it seems to work. No glitches, and the same functionality, no right click and no drag across all browsers, desktop and mobile.
Hope this helps and am fascinated to chat it though with you. Let me know.
Regards
Mike
- The topic ‘Coding Thoughts’ is closed to new replies.