0

I am running into an issue opening a pdf/rtf link in our application. Ideally when the user clicks on the link the 'attachment' it should be rendered in a new tab in the browser. But in IE 10 it only renders gibberish. This is what we used and worked in IE 7 which we have been been using for a while.

<a href="<%=row.fileName%>" target="_blank">My_attachmentpdf</a> 

But when I opened some other pdf online in the same IE 10 it worked fine. I was thinking may be I should try to force it to save to disk locally as an alternative. Any thoughts?
PS: The application is j2ee web application and uses struts 1.0.
Thanks.

5
  • 1
    if you see %PDF-1 at the start of the gibberish, then you're not sending out the appropriate mime headers and your pdf is being rendered as text/plain or text/html. Commented Sep 24, 2015 at 21:46
  • so you don't have the right mime headers to tell IE you're sending a PDF, so it's defaulting to plain text. Commented Sep 24, 2015 at 21:50
  • How do I do that in javascript? the row.fileName in the original post gives out \myApp\myPdf1.pdf. Commented Sep 25, 2015 at 13:40
  • there's nothing you can do in JS. it's something you have to fix on the server. Commented Sep 25, 2015 at 15:57
  • @MarcB I think I should try something like this below. But I don't have the ServletResponse object. Is there another option I can try? link Commented Sep 28, 2015 at 16:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.