Touchstart event is not firing inside iframe iOS 6

左心房为你撑大大i 提交于 2019-12-24 07:43:00

问题


I have a problem while selecting the text in IOS 6.The touchstart event is not firing inside an iframe while in iOS 6. On iOS 5 this is working fine.


回答1:


I also had the same problem but only in some of my iframes. Why only some of them, I don't know.

But I managed to get the event firing consistently in all of them by explicitly having an event listener on touchstart events in the context of the document containing the iframes.

So adding the following code for the doc containing the iframe was the workaround for me.

function dummy() {
    // console.log("A bug? Where?");
}

addEventListener("touchstart", dummy, false);



回答2:


I haven't seen this problem - the touchstart event is firing just fine for me inside an iframe. I would expect that instead you are getting an exception before accomplishing whatever it is that your touchstart event tried to do. Try putting an alert in the iframe, or, putting a try catch block around the body of the touchstart handler, and then alerting what the exception is.



来源:https://stackoverflow.com/questions/12363742/touchstart-event-is-not-firing-inside-iframe-ios-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!