An example of the problem of ifame parent window calling child window in Chrome

  • 2020-03-30 02:22:29
  • OfStack

One browser incompatibility problem encountered in the project:

Calling child Windows' js functions directly in the parent window of the ifame frame page with the child window's name works well in IE and Firefox, but not in Chrome.
 
<frameset rows="108,*,30" border="0" frameSpacing="0" frameBorder="0"> 
<frame name="header" scrolling="no" noresize src="base/header" /> 
<frame id="memuMain" name="main" scrolling="no" noresize src="${ctx}/index.jsp" /> 
<frame name="footer" scrolling="no" noresize src="base/footer" /> 
<noframes> 
<body> 
<p> This page USES a framework, but your browser does not support a framework. </p> 
</body> 
</noframes> 
</frameset> 

Under IE and Firefox you can write:
 
function changeMenu(menu_id){ 
header.window.changeMenu(menu_id); 
} 

Or:
 
function changeMenu(menu_id){ 
frames[0].changeMenu(menu_id); 
} 

Can be,

This is the only way to write it in Chrome, so it's the second way to write it when you're considering multiple browser compatibility issues.

Related articles: