IE6:window.onresize适用于IIS,在asp.net Dev Server上爆炸

时间:2022-04-08 13:25:01

Update 1:
Cannot reproduce this on a co-worker's computer (same setup as mine) so I assume this is a problem with my workstation and not a general one.

更新1:无法在同事的计算机上重现(与我的设置相同),所以我认为这是我的工作站的问题,而不是一般问题。

I'd appreciate it if someone would close this question as I don't have enough reputation to do it myself.

如果有人会关闭这个问题,我会很感激,因为我自己没有足够的声誉。

@MatthewMartin. Thanks for your comments :-)

@MatthewMartin。感谢您的意见 :-)


Update 2:
Unlike my coworker, I have VS90sp1-KB945140-ENU.exe (SP1) and VS90SP1-KB957912-x86.exe (JS Intellisense hotfix) installed on my machine. That appears to be the only difference between our setups. I removed both of them, but that didn't solve my problem.

更新2:与我的同事不同,我的机器上安装了VS90sp1-KB945140-ENU.exe(SP1)和VS90SP1-KB957912-x86.exe(JS Intellisense修补程序)。这似乎是我们设置之间的唯一区别。我删除了它们,但这并没有解决我的问题。


In my asp.net (C#) page is a little bit of Javascript to resize an object when the user resizes the window.

在我的asp.net(C#)页面中,有一点Javascript可以在用户调整窗口大小时调整对象的大小。

When I access the page using IE6 on my DEV server (IIS), it works.
When I access the page using IE6 via VS2008 using F5 or CTRL-F5 (both of which start the ASP.NET Development Server) it fails. It seems to enter an infinite loop of resizing where the adjSpreadsheetSize function fires the window.resize event, which invokes adjSpreadsheetSize ... Repeat ad infinitum

当我在DEV服务器(IIS)上使用IE6访问页面时,它可以工作。当我使用IE6通过VS2008使用F5或CTRL-F5(两者都启动ASP.NET开发服务器)访问页面时,它失败了。它似乎进入一个无限循环的调整大小,其中adjSpreadsheetSize函数触发window.resize事件,该事件调用adjSpreadsheetSize ...无限重复广告

I see quite a few people out there complaining that IE6 can't properly handle onresize events, but nobody seems to be having this precise problem.

我看到很多人抱怨IE6无法正确处理onresize事件,但似乎没有人有这个确切的问题。

Any idea why this code works on IIS but not on ASP.NET Development Server?

知道为什么这段代码可以在IIS上工作而不能在ASP.NET Development Server上工作吗?

Here's the relevant part of the code:

这是代码的相关部分:

[snip]
<head>
[snip]
<script language="javascript" type="text/javascript">
    window.onresize = adjSpreadsheetSize;
    window.onload = pageSetup;

    //Change spreadsheet size to fill the window (viewport) below the entry form
    function adjSpreadsheetSize() {
        var objSS = document.getElementById("OWC_data");
        var winWidth = document.documentElement.clientWidth;
        var winHeight = document.documentElement.clientHeight;

        winHeight -= document.getElementById('form_body').offsetHeight;

        objSS.height = winHeight;
        objSS.width = winWidth;
        return false;
    }

    function pageSetup() {
        adjSpreadsheetSize();
    }
</script>

[snip]
</head>
<body>
<form id="form1" runat="server" action="rawdata.aspx" method="get">
<div id="form_body">
[snip]
</div>
</form>
<div id="OWC_container">
    <object id="OWC_data" classid="clsid:0002E559-0000-0000-C000-000000000046">
    </object>
</div>

My setup:

  • WinXP Pro SP2
  • WinXP Pro SP2

  • Microsoft Visual Studio 2008 Version 9.0.21022.8 RTM
    • Installed Edition: Professional
    • 已安装版:专业版

    • Microsoft Visual Basic 2008
    • Microsoft Visual Basic 2008

    • Microsoft Visual C# 2008
    • Microsoft Visual C#2008

    • Microsoft Visual C++ 2008
    • Microsoft Visual C ++ 2008

    • Microsoft Visual Studio 2008 Tools for Office
    • 用于Office的Microsoft Visual Studio 2008工具

    • Microsoft Visual Web Developer 2008
    • Microsoft Visual Web Developer 2008

    • Crystal Reports Basic for Visual Studio 2008
    • 适用于Visual Studio 2008的Crystal Reports Basic

  • Microsoft Visual Studio 2008版本9.0.21022.8 RTM安装版:专业版Microsoft Visual Basic 2008 Microsoft Visual C#2008 Microsoft Visual C ++ 2008用于Office的Microsoft Visual Studio 2008工具Microsoft Visual Web Developer 2008用于Visual Studio 2008的Crystal Reports Basic

  • Microsoft .NET Framework Version 3.5 SP1
  • Microsoft .NET Framework版本3.5 SP1

  • The Website project lives on the DEV server (mapped as a local drive)
  • 网站项目位于DEV服务器上(映射为本地驱动器)

2 个解决方案

#1


0  

Since this is an activex object you're trying to load, maybe your MSIE is configured to trust http://localhost more than http://localhost:1235/foo ?

由于这是您尝试加载的activex对象,可能您的MSIE配置为信任http:// localhost而不是http:// localhost:1235 / foo?

Other differences with IIS vs ASP.NET Development Server:

IIS与ASP.NET Development Server的其他区别:

IIS only turns some files over to the aspnet filter, ASP.NET dev server turns all over to IIS.

IIS只将一些文件转换为aspnet过滤器,ASP.NET开发服务器全部转为IIS。

Also, sometimes the change in port # will change behaviors.

此外,有时端口#的更改将改变行为。

#2


0  

I added
alert("Viewport: " + document.documentElement.clientHeight + " - formHeight: " + formHeight + " = " + winHeight);

我添加了alert(“Viewport:”+ document.documentElement.clientHeight +“ - formHeight:”+ formHeight +“=”+ winHeight);

For some reason, the div "form_body" flips back and forth between "421" and "435" (difference of 14). So I added a border to try and see where the change occurs... <div style="border: solid 1px red;" id="form_body">

出于某种原因,div“form_body”在“421”和“435”之间来回翻转(14的差异)。所以我添加了一个边框来尝试查看更改发生的位置...

And when the border is there, the resize works. Easily reproducible... add the border style, and the resize fires 3~5 times. Remove the border and it repeatedly fires for as long as I care to sit and watch it.

当边界在那里时,调整大小工作。轻松可重复...添加边框样式,并调整大小3到5次。取下边框,只要我小心坐下来看它就反复点火。

WTF?

#1


0  

Since this is an activex object you're trying to load, maybe your MSIE is configured to trust http://localhost more than http://localhost:1235/foo ?

由于这是您尝试加载的activex对象,可能您的MSIE配置为信任http:// localhost而不是http:// localhost:1235 / foo?

Other differences with IIS vs ASP.NET Development Server:

IIS与ASP.NET Development Server的其他区别:

IIS only turns some files over to the aspnet filter, ASP.NET dev server turns all over to IIS.

IIS只将一些文件转换为aspnet过滤器,ASP.NET开发服务器全部转为IIS。

Also, sometimes the change in port # will change behaviors.

此外,有时端口#的更改将改变行为。

#2


0  

I added
alert("Viewport: " + document.documentElement.clientHeight + " - formHeight: " + formHeight + " = " + winHeight);

我添加了alert(“Viewport:”+ document.documentElement.clientHeight +“ - formHeight:”+ formHeight +“=”+ winHeight);

For some reason, the div "form_body" flips back and forth between "421" and "435" (difference of 14). So I added a border to try and see where the change occurs... <div style="border: solid 1px red;" id="form_body">

出于某种原因,div“form_body”在“421”和“435”之间来回翻转(14的差异)。所以我添加了一个边框来尝试查看更改发生的位置...

And when the border is there, the resize works. Easily reproducible... add the border style, and the resize fires 3~5 times. Remove the border and it repeatedly fires for as long as I care to sit and watch it.

当边界在那里时,调整大小工作。轻松可重复...添加边框样式,并调整大小3到5次。取下边框,只要我小心坐下来看它就反复点火。

WTF?