I am trying to host a very simple webpage that has a link to a passkit file on the server.
My goal is that users visit this page and click on an image and safari detects the pass and downloads it.
For testing purposes both the HTML file and the pass are in the same directory, here is the simple html page that I am using to link to the pass:
<html>
<head>
</head>
<a mimetype="application/vnd.apple.pkpass" href="pass.pkpass">
<img src="pass.jpg" />
</a>
</html>
For some reason this is failing, and I am getting a message in safari saying that it cannot download the file.
Any ideas on what is wrong?
I have emailed the pass to myself to test and it notices it when I open it in mail and adds it to passbook just fine.
Have you checked that the server understands the mime type, like this other post?
Sharing Passbook Passes .pkpass
It looks like to me that .pkpass files can't be served up from static links into Mobile Safari, the response must have some headers set. Here is what I do:
The server responding to the link must set the Content-Type and Content-Length headers to the 'application/vnd.apple.pkpass' and length of the .pkpass file. My code also sets the Content-Disposition header to 'attachment; ' + filename_header to signify to Mobile Safari that the content needs to be downloaded.
Related
I have tried everything I could think of to download any document from this page: https://www.acingov.pt/acingovprod/2/index.php/zonaPublica/zona_publica_c/indexAdjudicacoes/165
The download button launches a new window (while sending a POST request), the URL changes, but after a while this new page redirects to the homepage. I can see, using a HTTP sniffer, some ids and recaptcha response being sent to the new window, but nothing really happens and no ZIP file is downloaded. Tried different browsers and OSes. Any ideas/solutions? Thanks
We've had the following iOS message appear when logging in to our website:
Is there a file we can place into our website's root folder to tell iOS to redirect to the following exact URL rather than just our homepage when a user taps on Change Password on Website?
www.example.com/pages/reset-password/
One way to do it is by setting up a /.well-known/change-password redirect on your server to your actual password reset page.
Using your example, create a redirect from https://www.example.com/.well-known/change-password to https://www.example.com/pages/reset-password/ That's it. For the redirection, use the HTTP status code 302 Found, 303 See Other or 307 Temporary Redirect.
Alternatively, you could serve an HTML page at /.well-known/change-password with a <meta> tag using an http-equiv="refresh".
<meta http-equiv="refresh" content="0;url=https://www.example.com/pages/reset-password/">
The redirect is supported in Safari and Chromium-based browsers, and there's a W3C spec that defines the behavior. More details in https://web.dev/change-password-url/
I'm trying to fetch og (OpenGraph) tags from a URL and display in the app. I get the tags properly for most of the websites, but for some, I don't.
ex. This URL
When I render it on the browser and inspect, it shows me the meta tags, but when I try to fetch the html via cURL, it returns a html content without any meta. But, when I share the URL in Slack or FB, it renders the preview with the OG tags.
How do I do it on iOS?
Any help is appreciated.
The problem with the URL you shared is that the site requires Javascript to be enabled.
If you don't have Javascript enabled, you just get back a basic page saying that you need to have Javascript enabled to browse the site (hence, no Open Graph tags).
Your browser, Slack and Facebook execute Javascript but cURL does not. Neither will a URLSession in iOS.
In iOS, the only way you're going to be able to get access to the HTML for such a website is to use a WKWebView to render the page.
Then, when it's loaded, execute some Javascript using evaluateJavascript(_:completionHandler:) to get the OG tags.
That's the only workable solution for these cases using iOS libraries.
The iOS client for Facebook, LinkedIn etc do not do this on their iOS client. Their iOS client calls their backend, passing the URL for processing, and receives back the preview. Javascript is executed as part of this backend process.
There are public APIs around that will help you to do the same thing, such as:
https://opengraph.io
I want to redirect url, general code is as follows:
<html>
<head>
<meta name="referrer" content="always">
<script>
document.location.replace(url);
</script>
</head>
Other browsers can send referer, why the Safari is not?
How to send referer in the Safari browser on the ios?
Can you help me please.
The transition to many websites to https websites instead of http websites has caused a loss of referrer tags; this occurs because when transferring from an http link into a https link, the referrer information is dropped.
So if you're on an http page, and link off to an https page, no referrer header is available when you land there.
One solution to this is to change your pages to https; then your visitors will be going from https to https, and the referrer information will come along as expected.
Please try to add this to your
This should fix it for desktop Safari. It may not fix it for ios safari. You may want to use content of origin or place it as a hidden field in the page via JavaScript.
A good explanation: http://smerity.com/articles/2013/where_did_all_the_http_referrers_go.html
I You using frame(in my case) then use document.location.href = url; instead of replace(url)
When I try clicking a pdf link on my website in Chrome and FF it does not do anything. I can right-click and save as but I cannot open it up within the browser. Both browsers have adobe reader enabled and works when I remove the AWS Key and signature.
https://s3.amazonaws.com/bucket/sample.pdf?AWSAccessKeyId=&Expires=&Signature= // Does not open
https://s3.amazonaws.com/bucket/mypdf.pdf // Opens fine
It works fine in both IE and Opera. Any way to bypass this?
The reason of your problem is really obvious, but could be difficult to resolve. When you open nonKey link
https://s3.amazonaws.com/bucket/mypdf.pdf
browser gets .pdf extension at the end of the link and tries to download it. But when you have additional request params your link is not ends with .pdf and that may cause the problem.
It looks like your uploaded pdf file got no metadata for content-type. If you don't have Figure out content types automatically checkbox checked during upload, try to set content-type manually by adding metadata
content-type: application/pdf
Other idea is to make browser think that the link is ending with .pdf, so try to download with this link:
https://s3.amazonaws.com/bucket/sample.pdf?AWSAccessKeyId=a&Expires=b&Signature=c&file=sample.pdf