Internet Explorer 9忽略带有框架集的showModalDialog的dialogWidth / Height [英] Internet Explorer 9 ignores dialogWidth/Height for showModalDialog with a frameset

查看:150
本文介绍了Internet Explorer 9忽略带有框架集的showModalDialog的dialogWidth / Height的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个较旧的Intranet应用程序需要在模式对话框窗口中显示两个框架(固定菜单栏和可变内容数据视图)。目前使用 window.showModalDialog 功能打开对话框,只要我在Internet Explorer 8中打开页面(任何查看模式),一切正常或者在启用了兼容性视图的Internet Explorer 9中。

I've got an older intranet application that needs to show two frames (a fixed menu bar and a variable content data view) inside a modal dialog window. At the moment the dialog is opened using the window.showModalDialog function and everything works fine, as long as I'm opening the page in Internet Explorer 8 (with any view mode) or in Internet Explorer 9 with Compatibility View enabled.

不幸的是,当关闭IE9中的兼容性视图时,无论指定的dialogWidth和dialogHeight值如何,对话框窗口始终以266 x 138像素的大小打开。我创建了一个显示问题的小例子:

Unfortunately, when switching off the Compatibility View in IE9, the dialog window always opens in a size of 266 x 138 pixels, regardless of the specified dialogWidth and dialogHeight values. I created a small example showing the problem:

index.html(最初加载的页面):

index.html (the page initially loaded):

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<body>
    <input type="button" value="popup" 
        onclick="showModalDialog ('dialog.html', null, 'dialogWidth:500px;dialogHeight:400px;resizable:yes')" />
</body>
</html>

dialog.html(在对话框窗口中打开的页面):

dialog.html (the page opened inside the dialog window):

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html>
<frameset rows="*, 70">
    <frame src="frame1.html" />
    <frame src="frame2.html" />
</frameset>
</html>

frame1.html / frame2.html(两个帧的内容):

frame1.html/frame2.html (the content of both frames):

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<body>
    <p>Frame Content</p>
</body>
</html>

如果我在对话框中显示框架集文档,则只会出现此问题。打开常规html文档(包含带有某些内容的正文)时,大小按函数调用中的指定设置。

The problem only occurs if I'm showing a frameset document inside the dialog. When opening a regular html document (containing a body with some content), the size is set as specified in the function call.

此外,更改文档后的对话框大小已加载仅适用于常规文档,而不适用于框架集在 dialog.html 中打开html标记后插入以下代码:

Also, changing the dialog size after the document has loaded only works for regular documents, not for framesets, f.e. insert the following code after the opening html tag in dialog.html:

<head>
    <script type="text/javascript" />
        window.setTimeout (function () { window.dialogWidth = "500px"; window.dialogHeight = "400px"; }, 10000);
    </script>
</head>

因为我不想改变应用程序的整体结构(特别是基于框架的)我不知道我做错了什么,或者我是否在Internet Explorer中发现了一个错误,欢迎解决此问题的任何提示。

As I don't want to change the overall structure of the application (especially the frame-basedness) and I don't know if I'm doing something wrong or if I've found a bug in Internet Explorer, any hints for resolving this problem are welcome.

推荐答案

我还讨论了 Internet Explorer Web开发论坛并且能够获得我想在此分享的解决方案:

I also discussed the issue on the Internet Explorer Web Development Forum and was able to get a solution that I want to share here:

根据Microsoft Connect, Testing能够验证此问题是在Windows 8开发人员的Internet Explorer 10中解析的

According to Microsoft Connect, Testing was able to verify that this issue was resolved in Internet Explorer 10 on Windows 8 Developer.

对于IE9,可以通过删除 dialog.html 中的doctype声明来绕过该问题。这会强制此特定页面进入Quirks模式,但对话框会再次以正确的大小显示。

For IE9 the problem could be bypassed by removing the doctype declaration inside dialog.html. This forces this particular page into Quirks mode but then the dialog is shown in the right size again.

这篇关于Internet Explorer 9忽略带有框架集的showModalDialog的dialogWidth / Height的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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