JavaScript兼容性问题

发布于 2024-10-06 22:04:35 字数 913 浏览 0 评论 0原文

我一直在尝试找出我的一个网络应用程序中的一个奇怪的错误。以下是事件顺序:

  1. 用户单击网页中的链接 它会触发使用 a 的 javascript window.showModalDialog 打开一个 URL
  2. 该 url 是一个 asp.net 页面 使用二进制写入来显示 PDF

当我在 Firefox 中运行它时,它工作正常。当我在 IE 中运行它时,页面上没有任何显示,并且永远不会出错。

如果我直接在 FF 或 IE 中访问 asp.net 页面的 url,它就可以正常工作。是否有任何 window.showModalDialog 问题可能导致此问题?

来自 aspx 页面页面加载的代码:

    Dim req As WebRequest = WebRequest.Create("...")
    Dim resp As WebResponse = req.GetResponse()
    Dim rdr As BinaryReader = New BinaryReader(resp.GetResponseStream())
    Dim pdfByte() As Byte = rdr.ReadBytes(Convert.ToInt32(resp.ContentLength))
    Response.Clear()
    Response.ContentType = "application/pdf"
    Response.BinaryWrite(pdfByte)
    Response.Flush()
    Response.End()

Javascript:

window.showModalDialog(sUrl,'',sFeatures)

我发布的 javascript 是问题发生的地方。如果您需要更多,请告诉我。

I've been trying to track down a strange bug in one of my web applications. Here is the sequence of events:

  1. user clicks on a link in the webpage
    which fires javascript that uses a
    window.showModalDialog to open a URL
  2. this url is an asp.net page that
    uses a binary write to display a PDF

When I run this in Firefox it works fine. When I run it in IE nothing displays on the page and it never errors out.

If I go directly to the url of the asp.net page in either FF or IE it works fine. Are there any window.showModalDialog issues that could be causing this?

Code from the aspx page page load:

    Dim req As WebRequest = WebRequest.Create("...")
    Dim resp As WebResponse = req.GetResponse()
    Dim rdr As BinaryReader = New BinaryReader(resp.GetResponseStream())
    Dim pdfByte() As Byte = rdr.ReadBytes(Convert.ToInt32(resp.ContentLength))
    Response.Clear()
    Response.ContentType = "application/pdf"
    Response.BinaryWrite(pdfByte)
    Response.Flush()
    Response.End()

Javascript:

window.showModalDialog(sUrl,'',sFeatures)

The javascript i posted is where the problem occurs out. Let me know if you need more.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

合约呢 2024-10-13 22:04:35

我记得在 IE 中,页面的名称可能会导致问题,我几年前曾写过http://amrelgarhytech.blogspot.com/2008/06/windowopen-invalid-argument.html

但我不确定这是否是你的问题

I remember that in IE the name of the page could cause problems, I wrote about this years ago there http://amrelgarhytech.blogspot.com/2008/06/windowopen-invalid-argument.html

But I am not sure if this is your problem

九八野马 2024-10-13 22:04:35

我似乎 IE、模态对话框和 PDF 存在问题:

http://technicalsol.blogspot.com/2008/06/pdf-in-modal-dialog-box.html

解决方法似乎是将 PDF 嵌入 iFrame 中。

I seems there is an issue with IE, modal dialog and PDFs:

http://technicalsol.blogspot.com/2008/06/pdf-in-modal-dialog-box.html

The work around appears to be embed the PDF in an iFrame.

送君千里 2024-10-13 22:04:35

我最终将 window.showModalDialog 更改为 window.open。我发现其他一些人也有这个问题,但没有真正的解决方案让它与 showModalDialog 一起工作。

I ended up changing my window.showModalDialog to a window.open. I found a few others that had this problem but no real solution to get it working with showModalDialog.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文