-
19 Oct 2012 6:17 AM #1
Answered: Listen for loaded event on iframe
Answered: Listen for loaded event on iframe
Anyone knows how I can make my app listen for an event on an iframe, indicating it is fully loaded?
I have two kinds of iframes in my Sencha Touch 2 app:- Embedded Vimeo movies (youtube doesn't work well with html5)
- Google Maps
Help would be greatly appreciated.
-
Best Answer Posted by mitchellsimoens
The iframe element will actually fire a load event.
-
21 Oct 2012 5:23 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 436
- Answers
- 3113
The iframe element will actually fire a load event.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
24 Oct 2012 3:50 AM #3
Thank you for your help. I made a working example at senchafiddle here: http://www.senchafiddle.com/#AgV2f#9PqkW.
On startup the app shows a loadmask. After the load event fired on an iframe, the loadmask is removed. I actually put the iframe 'load' listener inside a Sencha Touch 'initialize' listener. Is this right or should it be a 'painted' listener?
The relevant code of the panel object:
Anyone knows why the title in the titlebar in the in the Senchafiddle example is Con... instead of Contact? Looks like an error in the standard css.Code:html: '<iframe style="width:90%;height:100%;" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.nl/maps/ms?msa=0&msid=203503883063435584829.0004c3dc968de020be3ed&ie=UTF8&ll=52.255503,5.269243&spn=0,0&t=h&iwloc=0004c3dca4e3baa4e0808&output=embed" id="fitmap782215" ></iframe>', listeners: { 'initialize': function(thisss, eOpts) { var myiframe = document.getElementById('fitmap782215'); if (myiframe.attachEvent) { myiframe.attachEvent("onload", a); } else if (myiframe.addEventListener) { myiframe.addEventListener("load", a, false); } function a() { Ext.Viewport.unmask(); } } }


Reply With Quote