How to make a text file with a custom extension open in myApp instead of being displayed as text in Safari

I would like to hear your ideas / suggestions for possible solutions for the following scenario:

  • There is an external web service that will serve the iPad user, a custom format file of my choice / design to be loaded via the Safari browser on the user's iPad.

  • The browser will not open this file, but instead will call myApp to read it and use its contents (uuid code to start its internal processes with its value)

I have researched this and now I know how to register "myApp" to handle custom file extension at the iOS level. This works fine as long as the file is not a text file (ie, if it is a true binary, I get the "open in myapp" prompt)

Once the file is recognized by Safari as a text file, its content is displayed on the page, and the user does not get the "Open in myApp" option, as is the case with a binary file of the same extension.

any ideas / suggestions are appreciated to put me on the right track. thank.

+3


source to share


1 answer


This worked for me in / etc / apache 2 / httpd.conf

<IfModule headers_module>
  <FilesMatch ".custom$">
    Header Set Content-type application/myApp
    Header Set Pragma public
    Header Set Expires 0
    Header Set Cache-Control private
  </FilesMatch>
</IfModule>

      



The key was the Content-type parameter, since Content-Disposition is ignored in Safari on iOS. Credit goes to Aaron. (sorry, I forgot your full name as another answer was deleted along with your comment). If you add your answer, I'll switch to it. Thank.

+1


source







All Articles