Thursday 25 June 2015

How Can I force Chrome in mobile to not resend a pdf request

Chrome on mobile has been giving us quite a bit of trouble. Here is what I see happening. We have a servlet which generates a pdf from data in the users session. Normally, the user hits the url, we generate the pdf, and stream it out. In the mobile environments, it saves the pdf to your download folder. All is okay.
With Chrome, it likes to use it's built in pdf utility to save the file. The pdf plugin is acting like it's own browser. We see a second duplicate request to the Servlet, however the pdf plugin does not submit the cookie which makes it part of the current browser session, so the session is empty, and a template pdf without the variables from the session gets produced.
In the desktop version, we had luck by setting the cache to not expire for a few seconds, so the pdf plugin just uses the first pdf to save or display, and does not send a second request. In mobile it tries to send the second request no matter what.
Does anyone have any suggestions on how to just make chrome save the pdf on the first call to the server?
Thanks so much!

No comments:

Post a Comment