I've a Ext.panel.Panel
and I would load content from an external web page into my panel.
I've tried to use the loader as described here: loader question
and you can found an example in this jsfiddle: /
Ext.require([
'Ext.form.*',
'Ext.tip.*'
]);
Ext.onReady(function() {
Ext.QuickTips.init();
Ext.create('Ext.panel.Panel',{
renderTo: Ext.getBody(),
height:400,
width:400,
id:'specific_panel_id'
});
dynamicPanel = new Ext.Component({
loader: {
/*load contents from this url*/
url: '',
renderer: 'html',
autoLoad: true,
scripts: true
}
});
Ext.getCmp('specific_panel_id').add(dynamicPanel);
});
Probably I haven't understood how to use loader (if it is possible) with external web pages. So my first question is: Is it possible to load the page into my panel using loader?
The second question: If the answer is "no" how do you suggest to load the content of that page?
Thank you all
I've a Ext.panel.Panel
and I would load content from an external web page into my panel.
I've tried to use the loader as described here: loader question
and you can found an example in this jsfiddle: http://jsfiddle/eternasparta/sH3fK/
Ext.require([
'Ext.form.*',
'Ext.tip.*'
]);
Ext.onReady(function() {
Ext.QuickTips.init();
Ext.create('Ext.panel.Panel',{
renderTo: Ext.getBody(),
height:400,
width:400,
id:'specific_panel_id'
});
dynamicPanel = new Ext.Component({
loader: {
/*load contents from this url*/
url: 'http://it.wikipedia/wiki/Robot',
renderer: 'html',
autoLoad: true,
scripts: true
}
});
Ext.getCmp('specific_panel_id').add(dynamicPanel);
});
Probably I haven't understood how to use loader (if it is possible) with external web pages. So my first question is: Is it possible to load the page http://it.wikipedia/wiki/Robot into my panel using loader?
The second question: If the answer is "no" how do you suggest to load the content of that page?
Thank you all
Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Aug 19, 2013 at 9:36 MarcoMarco 1,3344 gold badges17 silver badges41 bronze badges 02 Answers
Reset to default 12For external content, you will have to use an iframe. However if you want that iframe's dimensions to be managed by its container panel, you'll have to make it a ponent instead of just using html
property:
Ext.define('MyIframePanel', {
extend: 'Ext.panel.Panel',
layout: 'fit',
items: [{
xtype: 'box',
autoEl: {
tag: 'iframe',
src: 'http://it.wikipedia/wiki/Robot',
},
}]
});
See also an example with a Window and dynamic page loading in my recent blog post: http://nohuhu/development/using-render-selectors-to-capture-element-references/.
It is a security reasons (Access-Control-Allow-Origin).
You can just set "html" property of your panel as:
html: '<iframe src="http://it.wikipedia/wiki/Robot"></iframe>',
See: http://jsfiddle/sH3fK/2/
If you load the page from the same domain, you can just set "loader" property of your panel:
Ext.create('Ext.panelPanel', {
...
loader: {
url: 'content.html', //<-- page from the same domain
autoLoad: true
},
renderTo: Ext.getBody(),
...
});