How to capture a Safari iOS event when changing text selection in Javascript?

The following scenario: when you select text on iOS Safari (allows you to accept a โ€œnormalโ€ html page), a blue overlay appears indicating that you have selected a specific passage. In addition, you can change this selection to correct your initial selection area. I am interested in recording this particular event when a change in the selection area is made. Is it possible (when yes, how?) To catch such an event in Javascript? thanks in advance.

+7
source share
2 answers

Mobile Safari supports the selectionchange event, which fires on Document nodes:

 document.addEventListener("selectionchange", function() { alert("Selection changed!"); }, false); 
+13
source

I found that this event fires several times even when a single word is selected (with a tap), and, of course, it fires when you drag selection handles ...

I created a small workaround to get only the text selection end event.

you can see here : End of text selection event?

or in a short post on my blog : http://www.dimshik.com/end-of-text-selection-event-on-ios-workaround/

+3
source

All Articles