开发者

IE7 has issues displaying content from dynamically generated url in <object>

开发者 https://www.devze.com 2023-03-16 03:00 出处:网络
IE7 fails to display any contents in dynamically generated url inside the <object> element. Here\'s an example for loading pdf documents:

IE7 fails to display any contents in dynamically generated url inside the <object> element. Here's an example for loading pdf documents:

<object data="http://localhost:8080/Documents/Query?Id=document123&Session=1510" width="600" height="400"></object>

Th开发者_JAVA技巧e above code will fail to load, however, if I copy and paste the url into the browser's navigation bar, the pdf document will load just fine. If I then manually save the pdf file and replace the object tag with the code below, it works just fine.

<object data="document123.pdf" width="600" height="400"></object>

Is there a work around for this?


It's hard to be sure exactly what the problem is without knowing more about your development platform and possibly seeing some of the code for Query. But my guess is that it's down to the mime type that the server is presenting.

You should send the mime type header as application/pdf.


Just came accross this issue myself.

I don't know if yours was the same problem as mine but if you are using the following:

Response.AddHeader("Content-Disposition", "attachment; filename=...

Remove it, keep the content-type as "application/pdf" but don't assign a disposition, that way it will be processed as an outright file and not as an attachment to be downloaded.

0

精彩评论

暂无评论...
验证码 换一张
取 消