Any solution for export csv to file on iOS non-safari browsers?

Any solution for export csv to file on iOS non-safari browsers?

bfarkasbfarkas Posts: 181Questions: 48Answers: 0

I know this is really an iOS restriction, but using export options, in safari it downloads the file, in other browsers it displays the blob in a new tab. Anyone have a workaround? Or I was thinking of doing browser detection and having the user switch to safari when they load the page, but there doesn’t seem to be a good way to launch safari from a website either.....

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    I'm not following, sorry. Downloading the file happens in all browsers - it's the same in Chrome and Firefox. Could you give more information, please.

    Colin

  • bfarkasbfarkas Posts: 181Questions: 48Answers: 0

    Hi,
    It works on them all on desktops, windws/mac, but on iOS it only goes and downloads an actual file in safari. If using Chrome, it opens a new tab with a blob which you can then save as a csv file if you know what you are doing, but not the best user experience.

    I believe this is not a completely solvable thing, as I think it is a restriction from iOS's side, but trying to figure out a better user experience/work around than instructions on how to save. So I figured I would post to see if anyone has figured something out before now. The easiest seems to be to detect user is on iOS but not in safari, and redirect them to safari before they start their work, but it seems another iOS restriction is there is no good way to launch a user into a webpage in safari from a webpage....

    Thanks,
    Brian

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    For me, in Chrome (on Windows and Linux), this just downloads the file too. I've never seen CSV files go onto another tab. Maybe somebody else has some idea of what can be done,

    Colin

  • bfarkasbfarkas Posts: 181Questions: 48Answers: 0

    Yup, used that exact exmple to make sure it wasn;t something in my configuration. Have you tried it on a mobile device? This is iOS behavior.

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    I haven't, as I don't have access to iOS. I'll see if anyone else has.

    Colin

  • allanallan Posts: 63,213Questions: 1Answers: 10,415 Site admin
    Answer ✓

    As you say, this is an iOS restriction I'm afraid. The other browsers do actually just use Safari under the hood (or perhaps more correctly Webkit) since they aren't allowed to have their own rendering engines on iOS. It used to be an issue in Safari itself as well - it looks like they've finally fixed that.

    I'm not clear if the other browsers will need to try to interpret the blob themselves or if it is something Webkit should be doing for them. Either way, I'm afraid I don't know of any workaround for this.

    Allan

  • bfarkasbfarkas Posts: 181Questions: 48Answers: 0

    Yeah, was pretty sure, was trying to see if someone in the community had come up with an interesting workaround, even if it was just a good way to direct people into Safari.

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    It would be worth asking on StackOverflow, as it's a more generic issue. There are a few similar threads, such as this one,

    Colin

  • zermokzermok Posts: 1Questions: 0Answers: 0

    @bfarkas is right,
    I don't think it's an IOS issue but indeed bug issue from other browsers than Safari.
    today on IOS 14.6 Safari works as expected with blob and File, or FileReader or even with an anchor, fill the anchor.href with the url created from URL.createObjectURL(),
    for now I just succeeded a download on Chrome from FileReader

    as

                            reader = new FileReader();
                            reader.readAsDataURL(blob);
                            reader.onload = function(event){
                                link = document.createElement('a');
                                link.download = form.blobName.value;
                                link.href = reader.result;
                                document.body.appendChild(link);
                                link.dispatchEvent(new MouseEvent('click', {bubbles: true, cancelable: true, view: window}))/
                                revokeTimeout = setTimeout(function(){windowUrl.revokeObjectURL(url);document.body.removeChild(link);},500);
                            };
                            reader.onerror = function(event){
    

    alert(String(event.error));};

    But unfortunately Chrome IOS show the file to download name as "Document" without the real name nor original file extension.
    for Firefox ,Edge, Opera, Aloha no success at all, nothing happening.
    Why the heck they didn't fix it? I saw this issue since 3 years now. Only Safari fixed it.
    if anyone has a solution for these browsers pleas share thanks

Sign In or Register to comment.