• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

How to clear the browser cache when I close my browser.

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My application shows payslips of employees. So when a user click on a link it generates the pdf for which I have added the following code,



But the problem here is that, it creates a PDF in the temporary folder.

Is there a way to delete the cache after the browser showing the pdf is closed?

I tried deactivating cache with the following code,



but it gave me an error saying the file could not be downloaded.


 
Marshal
Posts: 67299
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope. The file must be copied to the local system in order to be viewed and there is no setting to cause it to delete itself.
 
Ratish Vichithran
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear Bibeault. Thanks for the reply...

But is there any way to avoid a Cache and also show a pdf using Content-Disposition as inline? . Because it is a security concern. Any other user using the work station can easily access the previous persons data.
 
Bear Bibeault
Marshal
Posts: 67299
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope. It is the responsibility of the user to keep his data secure.
 
Ratish Vichithran
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok let me put it this way. How will I show a pdf to the user and also adhere to security?
 
Bear Bibeault
Marshal
Posts: 67299
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me put it this way: you can't!

If you want to show the file to the user, it must be downloaded to their system. After that, it's their responsibility.
 
Bear Bibeault
Marshal
Posts: 67299
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alternatives:
  • Don't use a PDF or anything that needs to be downloaded to their system. Just show it as a no-cached page.
  • Explore password-protecting the PDF.
  • Don't show it in the broswer at all; send it in email.

  •  
    You firghten me terribly. I would like to go home now. Here, take this tiny ad:
    Java file APIs (DOC, XLS, PDF, and many more)
    https://products.aspose.com/total/java
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!