Document Interaction not always triggered from Safari - iphone

Through Document Interaction, my iOS app registers itself as an editor of .sgf and .ugi files. So I can open such files from - let's say - attachements in Mail.
However, when trying the same from Safari, I get inconsistent behavior. I try to open .sgf documents that are available via HTTP into my App.
Some http links trigger the gray box with "Open in..." button... Good.
http://gtl.xmp.net/reviews/data/82/8201-DavidB-mukai-jettero.sgf
Other links open as a text file in Safari... Unwanted.
http://learngo.world-go.org/golibrary/samplelessons/studygroup30k/2004-06-11_20-30k.sgf
Is there a way to get the "open in..." button on all?

After some research I got most of the answer from this page:
https://developer.mozilla.org/en/Properly_Configuring_Server_MIME_Types
And this web tool:
http://www.rexswain.com/httpview.html
SafariMobile looks at the MIME-type that is returned by the web server to determine what to do with the link (view within Safari or offer 'Open In...'.
Supported types like 'text/plain', 'text/html', 'image/gif' are all displayed within Safari. Whereas an unsupported type like 'application/zip' will trigger the 'Open in...' interface.
But Safari will even try to display a link of the type 'application/octet-stream', which is the mime-type typically used for unknown binary formats. I suppose Apple did this to overcome web servers that fail to provide the proper mime-type.
Supplying the type along within the HTML code is ignored by Safari.
<a href='file.sgf' type='application/x-go-sgf'>
The only (I think) solution is to change the configuration of the web server.

Related

How to define a custom "This browser is not supported" page in Sails.JS

When I try to use a Sails.js site in production mode with a Safari 5.1, I'm getting a "This browser is not supported" page with a big Sails.JS logo. What's the proper way to customize this page ? . Also, how can I check what rules are applied to allow or block old browsers from using the site?
The website works as expected with modern browsers ( it even works in IE 11 ).
I found it.
It's defined in the layout of the site that was generated from the template file caviar-layout.js . The layout is in /views/layouts
The Layout File includes the image, rules to block browsers and the custom message.

How to force links to open in iOS Safari?

my webpage has links to download Passbook .pkpass files.
This works fine in Safari for iOS since Apple's browser supports the mime type: application.com/vnd.apple.pkpass
Facebook's iOS browser (as well as others) does not (yet) support this mime type. Therefore, if a user follows a link to my site from within Facebook, they can't download my Passbook files. However, if they click on 'Open in Safari' then they can download the file.
How can I code my webpage such that clicking on a link will force open Safari on iOS?
Andrew
These headers should be helpful to what you're doing.
Content-Type "application/force-download"
Content-Description "File Transfer"
Content-Disposition attachment
ForceType "application/octet-stream"
I suggest you try to set them in your .htaccess or httpd.conf file with the following code:
<FilesMatch "\.(pkpass)$">
Header set Content-Type "application/force-download"
Header set Content-Description "File Transfer"
Header set Content-Disposition attachment
Header set ForceType "application/octet-stream"
</FilesMatch>
It's a little overkill, but will ensure the download is forced across all browsers. Change the pkpass to anything else to force the download of any other file type.
I didn't manage to find a way to do this yet. Somehow, forced pkpass downloads won't work in the Facebook mobile browser.
The best way is to guide the user to open the page in Safari.

Opening HTML form attachments in iOS5

I have received an email on my iPhone (with iOS 5.0.1) with an HTML attachment. The HTML attachment contains a form to fill out and submit. The problem is that submitting the form does not work. I click the Submit button and I get switched Safari, but the form information is not posted. Instead, the URL indicated by the form gets requested as via the GET method.
Is the problem that the Quick Look viewer is simply a passive viewer that does not do forms? I'd like to be able to open the attachment in Safari instead, but that does not appear to be an option. If a tap and hold the attachment, the only options I get are Quick Look and Dropbox.
Thanks!
After much research I've decided it simply does not work. Probably by design as a sort of security feature. I discovered a similar problem with Android phones.

Open the url in the current active browser

How can I open an url in the current active browser which is been provided as a part of the mail
Example- I receive an email in my outlook.I am browsing also.If I click on the url provided in the email it must open in the current browser window which is open
I don't think that is possible with a URL. The handling of http: protocol is operating system dependent, and really shouldn't be messed with.
My default browser is FlashPeak SlimBrowser and with this as my default browser it isn't a problem since this is what it does by default. I use SlimBrowser since the web site I work on is keyed to IE and SlimBrowser uses the IE Object with any of the automatic IE junk disabled. No question about popups since they don't happen unless I click on them.
The click interface in outlook is using the API to open the default browser window. The default browser determines how it is going to handle the request.

Possible to open iPhone Safari and target a specific window?

I have an app that uses OAuth to authenticate, which means the user must be directed to the website to authorize the application. I prefer to make it obvious to the user that they are using a standard browser to authorize at the original site rather than just using a web view to show the content within my app. However, every time they are directed to Safari (via openURL), it launches a new Safari window and once Safari has 8 windows open, it simply fails to work at all.
I'm wondering if there is an equivalen to the "target" attribute of an anchor tag in html which would allow me to cause all openURL calls from my application to open in the same window.
There is other functionality that I can expose via the web application, creating a hybrid app between native iphone functionality and web app functionality in Safari, but if I have to launch a new window every time I switch between the app and Safari, it becomes unworkable. The Youtube app is obviously able to return the user to the previous page after showing a video, but that might well be a custom plugin in Safari for iphone. Also, while returning to the previous page is somewhat useful, sending them to a new URL in the existing window really opens up a lot of possiblities.
I'm pretty sure there is no way to pass a target parameter to openURL:.
What I noticed about Safari is that it won't open another tab if the page you are opening with openURL: is/was already open in Safari. It just reloads that page. This might sound trivial and not helpful but perhaps you could use it to your advantage if you can make your web application only use one page. Different views or states could be expressed with #anchor tags.
An example is http://m.flickr.com. Notice their URL structure? It goes http://m.flickr.com/#/home, http://m.flickr.com/#/explore/interesting/, http://m.flickr.com/#/search and so on. All of these are different web pages to the user but to Safari it's all the same page.
I found iOS 6.0.1 Safari will open the same tab with a simple hashtag, without the slashes. So with the above example http://m.flickr.com, openURL to http://m.flickr.com#someinfo opens to the same tab.
In your webpage, use window.location.hash to return the params. In the above example it will return #someinfo.