Opening .pdf files in browser from Amazon S3 with AWS Key and Signature attributes? - 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

Related

Download a file that after recaptcha fails and redirect to home page

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

Cannot download files via the Facebook browser

A website I work on has a download pdf functionality, sending the proper HTTP headers in the response, to download the PDF file.
It works smoothly across the browsers (Safari, Chrome, Firefox etc), but recently we discovered it fails in the Facebook browser.
The scenario is that people would eventually open the website while navigating on Facebook, and may click the Download pdf button.
Facebook would show an error message saying Cannot render this kind of file or something similar, and the browser view would even crash (backwards/forward browser buttons won’t work anymore), bringing the user back to the Facebook feed.
Is there a classical issue to this problem? I tested using Facebook for iOS.
The headers we use are the following, as suggested here:
Content-Type: application/pdf
Content-Disposition: attachment; filename="filename.pdf"
I just guess this is a general issue, but after a quick search I can’t seem to find any information about it.
While it may be a Facebook, I’m just wondering what would be the recommended ways to fix this on our side.
In the worst case, I thought to hide the button if the user agent tells us that the user uses Facebook browser. But I just guess there should be better solutions.
There is no simple solution for this. The browsers from social apps will not download the files.
You will have to check the user agent of the browser and not display the download buttons (hiding the UI when needed).

Google Analytics configuration file can't be created

I'm adding Google Analytics to my iOS app, and there seems to have been some changes in the SDK. The tutorial at https://developers.google.com/analytics/devguides/collection/ios/v3/ says that I have to create a configuration file, but when I click on the "Get a configuration file" link I'm directed to a page that just shows a loading spinner (with some errors printed to the browser console).
I don't have time to wait for Google to fix their service, so I'm wondering if it's possible to create the file manually?
It seems that if you look at the error in the browser console and go to the URL it can't load, you can sign in and it works. And thereafter, the original link works too.
As crazy as it sounds, I resolved this error by using Internet Explorer to load the site.
user102008's answer worked for me. I also noticed that if you create a new Property in the GA Admin panel, the configuration file generator page will load properly.

Passkit pass will not download to device

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.

Application Cache manifest could not be fetched, because a redirection was attempted

I'm writing an html application for the iPad, and my cache.manifest file lists all my assets. I've verified that everything is cached by looking in the console of Google Chrome.
But when I go to Safari on the iPad, it says:
Application Cache manifest could not be fetched, because a redirection
was attempted.
I'm even loading jQuery and jQuery mobile locally to make sure that loading them remotely is not causing this issue.
If you link to the page with http://www.yourname.com/ instead of using a relative link, that will do it.

Resources