JavaScript 错误“对象不支持此属性或方法”在调试模式下显示
我有一个 C# .NET Windows 应用程序,它将获取 HTML 文件并使用它们来显示数据。 HTML 文件中将包含 javascript 来帮助解析/显示数据,其中之一使用 activeXObject 来显示 PDF 文件。
当我安装 Windows 应用程序的二进制版本时,PDF 文件可以正常显示。 当我从 VS2008 的调试模式运行时,出现错误:
无法加载详细信息页面。一个 脚本中发生异常。 错误名称:类型错误。错误信息: 对象不支持该属性 或方法
它们都引用相同的 HTML 页面,唯一的区别是一个是二进制安装,另一个只是我的调试构建运行。
我需要让它在调试模式下工作,以便我可以测试,但我不确定出了什么问题;任何建议都将不胜感激!
编辑:抱歉,这是 HTML 代码:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Received Fax Preview Page</title>
</head>
<body>
<object data="myfile.pdf" type="application/pdf" width="800" height="600">SUP</object>
</body>
</html>
我只是使用 C# Web 浏览器来显示它。
_webBrowser.DocumentText = htmlDoc;
I have a C# .NET windows application that will get HTML files and use them to display data. The HTML files will have javascript in them to help parse/display the data, and one of them uses an activeXObject to display PDF files.
When I install a binary version of the windows application, the PDF file displays properly and is fine.
When I am running from DEBUG mode from VS2008, i get the error:
Failed to load details page. An
exception occurred in the script.
Error name: TypeError. Error message:
Object doesn't support this property
or method
They are both referring to the same HTML page, the only difference is one is a binary install and the other is just my DEBUG build running.
I need to get it working in DEBUG mode so I can test but I'm not sure what's wrong; Any suggestions would definitely be appreciated!
Edit: Sorry here is the HTML Code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Received Fax Preview Page</title>
</head>
<body>
<object data="myfile.pdf" type="application/pdf" width="800" height="600">SUP</object>
</body>
</html>
And i'm just using the C# web browser to display it.
_webBrowser.DocumentText = htmlDoc;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最后通过在 VS 中切换到 x86 平台(从任何 CPU)并构建项目来使其工作。我猜测,因为我的机器是 x64,在调试模式下,应用程序以所有 x64 组件为目标,而 IE x64 无法加载 PDF,但也许在二进制文件(即 x64)中,它会转到通用 IE x86 位来打开 PDF ?
不是 100% 确定这个解释,但它现在正在起作用。
Finally got it to work by switching to x86 platform in VS (from Any CPU) and building the project. I'm guessing since my machine is x64, in debug mode the application targets all x64 components and IE x64 can't load PDFs, but maybe in the binary (which is x64) it goes to the common IE x86 bit to open the PDF?
Not 100% sure the explanation, but it is working now.