18.09.2021

Safari Cannot Download This File Ipad

Everytime i get on Safari, whether it be to go to a website or to even. On google, it gives me the message 'Safari cannot download this file'.

  1. Safari Cannot Download This File Ipad 1
  2. Ipad Message Safari Cannot Download This File
  3. Click Here To Download This File

Edit by @eligrey: Please tell Apple how this bug is affecting you in https://bugs.webkit.org/show_bug.cgi?id=102914 if you want this fixed.

Edit by @jimmywarting
The safari bug #102914 has been marked as fixed now

File

according to the commit position, download attribute is fixed in WebKit v602.1.27.
The latest beta build (Safari Technology Preview) is based on WebKit v602.1.25, and of course doesn't contain this patch, so there's no simple way to test.

In the meantime, if you want to support Safari 7, you'll probably want to use Downloadify (uses Flash, not HTML5).

  • Blob is not supported
    This has been solved with Blob.js using BlobBuilder as fallback and then base64 data uri if that are not supported either
  • URL.createObjectUrl
    Has been covered by both FileSaver.js and blob.js
    Blob.js overrule createObjectUrl with it's own base64 url constructor only if it's a 'fake blob' (i.e not a File or Blob representation) it will use window.URL, fallback to window.webkitURL or use it's own base64 function to create those 'fake blobs' disabled='>The 'can't open blob url' issue (partly supported) - screenshot

The page you opened redirected you to a page that isn't supported by safari
Safari can't open the page becuse Safari can't be redirected to address that begin with 'blob:'.

  • This is mostly cased by unsupported mime type, Safari do support opening blob url, but only if it's a mimetype that safari can understand like simple plain/text or a common image like image/png.
    • This will result in a new tab from which the user can just hit +S to save it
  • ATM FileSaver.js looks at the mimetype to see if it is application/octet-stream (wish is commonly used to force saving files from the server)
    If it's then it read the blob as base64 using FileReader to open a data:attachment/file' + base64 url in order to save it.
    • It's not possible to create a blob with attachment/file type directly and open it, then you will get errors like this: Failed to load resource: Frame load interrupted it has to be base64 for some reason..
    • the resulting filename will be 'unknown' when doing this
  • The blank page error partial supported - (formuly known as 'can't open blob url', see above)
    This can easily be reproduced by doing:

If you replace window.open with location.href = you will get the Failed to load resource: Frame load interrupted and be unable to save the file that is not the case for all mimetype, mimetypes that Safari can display can be opened this way

A little side note here is that window.open only works on trusted events meaning:

  • It will only be able to open the url when user interacts with the website like a onclick event (more about isTrusted event here - almost pointless becuse browser support)

I have also found out that the trusted event persist for 1000 ms, so you could do:

  1. download attribute in safari is not supported
  2. It will try other means to save the blob by opening a new url
  3. If the mimetype can be rendered by safari it will be able to display it in a new tab
  4. If the mimetype is application/octet-stream:
    4.1 Create a base64 link with FileReader api
    4.2 try to open a new tab using window.open + base64 url
    4.3 if it was more then 1 sec before the user interaction happened it will use the current page instead
    but that is likely going to fail because (see first example using location.href) Failed to load resource: Frame load interrupted This may still work if the mimetype is not application/octet-stream and the saveAs was not called synchronous
  5. Safari don't have anything like msSaveAs()
  6. safest way to force the file to be saved is to have a data:attachment/file' + base64 ready and open that link using window.open() when the user interacts with the website (or at least to it under 1 second)
  7. when saving it as a attachment filename will be 'unknown'

I am aware that iPad does not have a file-system in traditional sense.

I want to know how Safari for iOS behaves when trying to download/upload files from/to a website.

Suppose I go to sourceforge.net and click on a link to download zip file? Would Safari download it? If yes, where does it get stored and how do I access it (without using iTunes to first move it to a PC).

Does Safari on iOS allow the downloading of only some files and reject others, or does it allow downloading all of them or rejects all of them?

Lastly, if a webpage has a file upload control (input type='file'), how does Safari behave (would it allow upload, allow upload on only some sites or the download control does not work at all)?

bmike
r_honeyr_honey

2 Answers

Actually the iOS does have a filesystem, and each app gets access to a sandboxed portion of the file system.

The iOS 'system' itself has several programs that do access the filesystem directly, but mobile safari acts more like a restricted app purchased from iTunes than say springboard or the app store app itself.

Uploads are basically impossible in iOS. Mobile Safari doesn't read from the address book (which most sandboxed apps can and will do by default). It also doesn't use the photo picker to upload pictures or video.

Downloads are possible, but often require a helper app to store and use the download. Safari handles mp3, streams, and other media itself and lets you listen or watch the 'download'. You can't save it in the way a computer allows, but the web server thinks a download happened and safari actually downloads the file to it's cache (where it stays until the cache fills and it ages out and gets deleted). All other file types are handled as the iOS uses UTI file detectors to see which apps installed can handle a potential download. (The developer document I linked to has several paragraphs readable by anyone, but it dives into developer minutia very quickly so feel free to bail on that link before the simple idea behind UTI gets confused)

If safari detects another app has registered for a download, you will see an 'open in apptastic' to indicate that mobile safari will download that file but hand it off to another app to store in that app's sandbox.

Safari Cannot Download This File Ipad 1

Safari uses a system API call to have the iOS do the writing across sandboxes.

Since you asked about a zip file, all you need on your iPad is to find an app that tells iOS it can handle zip files, and as long as the sourceforge servers send enough data for mobile safari to detect a zip file, you can download it over to your app. The reverse trip is harder, your ZIP app can't really push a file to safari for upload. Your app has to be programmed to log into sourceforge directly and call the upload API itself. (which technically will probably use the mobile safari code / webkit to do a http upload - but that all happens behind the scenes, not in what we see and control as mobile safari with the blue compass icon)

bmikebmike

Mobile Safari itself cannot store files for you (without jailbreaking). However some Apps like Dropbox register with Safari and enable limited support for some filetypes.

File inputs are just disabled/greyed out on Mobile Safari.

Ipad Message Safari Cannot Download This File

GerryGerry

You must log in to answer this question.

Click Here To Download This File

Not the answer you're looking for? Browse other questions tagged iosmobile-safari .