I need to have a valid session to download files from my web application.
When I open my web application on my iOS device, log in and try downloading the file (PDF) from my site, I will be kicked out and the link will open in Safari. To load the page, the user needs to log in again from Safari.
How to make a file open in a web application and run a download form instead?
I use Carrierwave and in the controller I have this to start the download:
class DocumentsController < ApplicationController
UPDATE: I found a semi-working solution that opens the file directly in the browser:
$(document).ready -> if 'standalone' of window.navigator and window.navigator.standalone
Using this piece of code, we force iOS users to work in full screen mode (web application) to open all a links inside the application. The problem is that if the user opens the file, there will be no “back” -button. And since iPhone users lack the physical back button, they will have to force restart the entire application to exit the file shown.
source share