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.