Search code examples
javascripttouch-eventmouseclick-event

How to register a click event on something that only accepts tap events


I'm trying to load a mobile-specific website in to an iFrame that is meant to be viewed on a desktop browser. Unfortunately some of the events on the mobile-specific website only register taps, and not clicks, and therefor the site is pretty useless within the iframe.

Fortunately I am able to stick a JS script in to the header of the mobile specific site, so I was wondering if there was any way that I can fire a click event on the target that is meant to be tapped on.

Any help is much appreciated.


Solution

  • Maybe this will work:

    document.onclick = function(event) {
        event.target.touch();
    }