Reputation: 337
Apparently Mountain Lion 10.8.2 Safari "supports" Passbook passes, in that it will preview and offer to sync ".pkpass" files to iCloud for the user's configured iPhone to load into Passbook.
However, I haven't found any documentation on how to get the browser to load such a file, other than the user explicitly downloading such a file.
Ideally, there would be a <link rel="alternate" type="application/vnd.apple.pkpass">
or similar tag so a supporting (and suitably configured) browser could pick it up and offer it. I can't find any mention of such a feature.
Other than that, the user would need to be directed to "click here" to download a pkpass and hope to heck they knew what it was and what to do with it. Otherwise, it's an opaque blob in their Download folder.
Obviously I don't want to be explicitly sniffing the User-agent for iOS 6 or OS X 10.8.2 and above, as this would not also check if the user had iCloud configured, and also precludes support for PassWallet and similar apps for Android and the like, along with other supporting browsers.
Upvotes: 8
Views: 1929
Reputation: 7691
The obvious solution is to include an Accept header for the vnd.apple.pkpass content type. This is precisely the intention of this header.
That's not in the hands of an individual developer unfortunately.
Microsoft do this for the .Net Framework where they send the information as part of the User-Agent. This lets you detect if the .Net Framework is installed on the visitor's machine.
OS X Lion should include this header in all browser requests issued and iOS devices should send it too.
At present, the best option you would have is the one you've outlined. If the UserAgent is for iOS or OS X Lion you can infer support. It's not ideal, but the best you can do at present.
Upvotes: 2
Reputation: 1751
Your server needs to send a "Content-type: application/vnd.apple.pkpass" header with the pkpass file.
Upvotes: -1