After coming across tutorials and step-by-step guides on how to trigger Javascript click events, I am now wondering how I can effectively fire a touchcancel
event using plain Javascript.
var event = document.createEvent("MouseEvents");
event.initEvent("touchcancel", true, true);
event.synthetic = true;
document.dispatchEvent(event, true);
I tried using the "MouseEvents"
parameter instead of "TouchEvents"
, as it was throwing an error.
However, the above code doesn't seem to be functioning as expected.
My goal is to trigger the "touchcancel"
event in order to clear excessive pointer
instances, as I noticed that the browser itself has the capability to call 'touchcancel' for this purpose.