Displaying iframe in sencha touch app with scrolling

extjsiframe

I'm trying to load an outside webpage in an iframe in my sencha touch app. The webpage is of dynamic height so I need the iframe to be scrollable within the sencha touch app. I have been able to get the page to scroll, but the underlying iframe does not render any of the web content below the initial viewport. Here is my code. Does anybody have any ideas?

App.views.Help = Ext.extend(App.views.Base, {
    title: 'Help',
    mainLevel: 10,
    subLevel: 1,
    backButton: 'dashboard',
    forceTab: App.OTHER_TAB,
    forceSideTab: App.HELP_TAB,
    layout: 'fit',
    bodyPadding: 0,
    items: [{
        xtype: 'panel',
        scroll: 'both',
        items: [{
            id: 'iframe',
            layout: 'vbox',
            width: '100%',
            height: '2000px',
            html: [
                '<div style="width:100%;height:2000px;position:fixed;top:0;left:0;background-color:Transparent;float:left;z-index:99;"></div>',
                '<iframe style="position:fixed;top:0;left:0;float:left;z-index:1;" width="100%" height="2000px" src="http://mvretail.assistly.com/customer/portal/topics/118700-mobile-basics"></iframe>'
            ]
        }]
    }]

/* OLD attempts
    html: '<iframe style="overflow-y: scroll; -webkit-overflow-scrolling: touch"     width="1000px" height="1200px"     src="http://mvretail.assistly.com/customer/portal/topics/118700-mobile-basics"></iframe>'

    html:    '<div  style="overflow-y: scroll; -webkit-overflow-scrolling: touch"><iframe     width="1000px" height="1000px"   src="http://mvretail.assistly.com/customer/portal/topics/118700-mobile-basics"></iframe>  </div>'
*/

});

Best Answer

Ah, a familiar problem. After trying and trying for ages, I've figured this one out. Here's a link to the blog post I made to help solve this for everyone else (and myself

Tech-Talk-Tone : Scrolling External Webpages in Sencha Touch with iFrames & More

Here's the fix ::

Ext.Ajax.request({
                url: ‘your/external/web/page/url.html’,
                success: function(response, opts) {
                    Ext.getCmp(‘YourPanelId’).update(response.responseText);
                }
});

To make this work for external links, you need to enable either Cross Domain or Cross Browser Ajax requests on the server that you host the app on (or Phonegap). Once you do that, it works fine :)

Related Topic