javascript compatibility question
I've been trying to track down a strange bug in one of my web applications. Here is the sequence of events:
- user clicks on a link in the webpage which fires javascript that uses a window.showModalDialog to open a URL
- 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 开发者_JAVA技巧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.
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
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.
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.
精彩评论