0

This is a project on JSP. 1)I have this code where a button is pressed and the action is rendered to another page,which is a JSP page containing a pdf and the user is able to save it. I had tried my code a month back and it worked fine,now when I try it,it doesnt work on chrome,works on mozilla though. this is the line of code

 response.setHeader("Content-Disposition", "inline; filename=Question.pdf");

2)My second problem is that,I have a reset button,this button resets the database.this function works fine on chrome but not on mozilla.I have no idea why it doesnt,there is no action taking place at all. this is the line of code for that

<button type="button" onclick="reset.jsp"><a href="reset.jsp">RESET</a></button>
Santino 'Sonny' Corleone
  • 1,735
  • 5
  • 25
  • 52

1 Answers1

0

For question 1): What I know from the difference between "content-disposition", "attachment;filename=somefile.ext" and "content-disposition", "inline;filename=somefile.ext" is that in the inline case the browser will try to render it alone and if it can't it will prompt the user to download it. Maybe in your case you had an extension of Chrome that was capable of showing PDF files in the browser and now not. See Content-Disposition:What are the differences between "inline" and "attachment"?

As for question 2) : This code onclick="reset.jsp" is not a valid construction. Onclick has to be a valid JavaScript function. See http://www.w3schools.com/jsref/event_onclick.asp. And it you case it not necessary to have it at all as you have an link inside the button which performs the actual action. I guess Chrome ignores this error and MOzilla not. Try removing onclick="reset.jsp" from the button.

Community
  • 1
  • 1