PDA

View Full Version : I can't get the parameter values where defined in my Iframe window ?



zdtwyjp
1 Jul 2010, 1:41 AM
This is my code!


In the main.jsp , the Ext code like this:
var tabs = new Ext.TabPanel({
id : 'main_panel',
region : 'center',
margins : '5 5 5 0',
resizeTabs : false,
enableTabScroll : true,
autoScroll : true,
autoShow : true,
closable : true,
activeTab : 0,
items : [{
title : 'TabOne',
autoWidth : true,
bodyBorder : false,
layout : 'fit',
iconCls : 'tab_home',
html : '<iframe name="mainIframe" width="100%" height="100%" frameborder="no" src="iframe.html"></iframe>'
}]
});

In the iframe.html , the code like this:
<script type="text/javascript">
var test = 'test';
</script>


The first time I can get the parameter values throw "window.frames['mainIframe'].test" in IE8 and Firefox , but after
I close the "TabOne" and open it again , I can get the parameter values only in IE .In the FireFox it throws the parameter "test" is undefined!
I don't know how to solve it?
can you help me ?
can you tell me what happened?

4 Jul 2010, 8:45 AM
When an iframe is hidden with Ext JS, it's essentially destroyed. When shown again, it's recreated *and* reloaded. I've seen this with Firefox and Webkit based browsers. To fix this, you need Doug Hendric's Managed iframe extension, which plays some tricks to prevent this from happening in those browsers.

With IE, you won't see this behavior.