Opera框架BUG? [英] Opera frames BUG?

查看:88
本文介绍了Opera框架BUG?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<script>
var G = function (id) {return document.getElementById(id); }
var C = function (tag) {return document.createElement(tag); }

window.onload = function ()
{
var f = C('frame');
f.name = 'my';
f.id = 'my';
f.src = 'about:blank';
G('content').appendChild(f);

alert('test');   

window.frames['my'].document.write('Loading...');
}
</script>

<frameset id="content" rows="100%,*" cols="*" frameborder="no" border="0" framespacing="0">
</frameset>
</html>

alert('test'); //删除此行,Opera加载不成功。
为什么? IE浏览器Chrome浏览器没有问题......

alert('test'); // Remove this line, Opera load is not successful. why? IE Firefox Chrome Safari No problem...

推荐答案

是的,另一个关于:空白加载计时问题..这真的很难搞定这个权利: http://hsivonen.iki.fi/about-blank/

Yay, another about:blank load timing problem.. It's really hard to get this right: http://hsivonen.iki.fi/about-blank/

无论如何,当Opera做一个像这样的简单事情时,与其他人不一样,根据定义,它是Opera中的一个错误。我已经报告过CORE-45144 - 当FRAME通过DOM(appendChild和朋友)附加到FRAMESET时,不会立即更新window.frames集合,因此应该在适当的时候修复它。有一个正在进行的维护项目可以解决这个问题,结果不会成为Opera 12,但很可能是下一个重大更新。

Anyway, when Opera does a simple thing like this differently from everybody else it's by definition a bug in Opera. I have reported "CORE-45144 - window.frames collection not immediately updated when FRAME is appended to FRAMESET through DOM (appendChild and friends)" so it should be fixed in due course. There is an on-going maintenance project that might solve this issue among others, results won't make it for Opera 12 but quite likely the next majorish update.

如果你需要一个解决方法,只需使用带有一些小超时值的setTimeout()来延迟稍微写入新帧的代码。

If you need a workaround, just use setTimeout() with some small timeout value to delay the code that writes to the new frame slightly.

感谢您引起我的注意: - )

Thanks for bringing this to my attention :-)

这篇关于Opera框架BUG?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆