Attach Event Listener to all parent iFrames -
important notes:
- all of these iframes of same origin shouldn't have cross domain issues.
- i don't know number of iframes nested inside of. range.
- no jquery please
overview:
i being injected onto page inside of iframe. iframe has potential of being nested inside of iframe , can nested inside of iframe , on , on. can below:
<iframe> <iframe> <iframe> <iframe> me! </iframe> </iframe> </iframe> </iframe> what put event on each of iframes prevent ios rubber band scrolling so:
document.body.addeventlistener('touchmove', function(e) { e.preventdefault(); }); if add above code in web inspector console each iframe, can achieve desired effect. however, need scope detect amount of parents , attach event.
something like:
var iframe = parent.document.getelementsbytagname('iframe')[0].contentwindow.document; while(iframe){ iframe.addeventlistener('touchmove', function(event){ event.preventdefault(); } iframe += parent.iframe; } the above doesn't work gets idea across. ideas?
Comments
Post a Comment