Question

I just read somewhere that I can use:

"ontouchend" in document

as a way to detect whether the "touchend" event is available in that browser.

How can I tell which browsers support the "oneventname" in document expression?

Was it helpful?

Solution

{{ "x" in y }} is just a standard javascript expression for testing if a property exists in an object.

Most browsers do store a property on the document object for event handlers, but there are exceptions and important details to note.

See: http://perfectionkills.com/detecting-event-support-without-browser-sniffing/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top