0

I program a webapp which use ink filepicker for opening/saving text files from/to the cloud. In mobile browsers, when I open a file via :

filepicker.pick({extension: '.txt'},
    function(FPFile) {
        filepicker.read(FPFile, function(data) {
            // Open file
        });
    });

There is no problem, whether or not the "block popup" option is activated in browser. But when I save file via :

        filepicker.store(
        mycontent64,
        {base64decode: true, mimetype: 'text/plain'},
        function(InkBlob) {
            filepicker.exportFile(
                InkBlob,
                {suggestedFilename:"myfile.txt",extension: ".txt"},
            function(InkBlob) {
            // ******* Save file
            },
            function(FPError) {
                console.log(FPError.toString());
            });
            },
        function(FPError) {
                console.log(FPError.toString());
        }
    );

it only works when the "block popup" option is deactivated in the browser (Safari on iPad or Android stock browser, or google chrome Android...). If it's activated, browser refuse to open export dialog in a new tab, and with "FPError 131" in console...

I can't tell my users to deactivate this option !

So is there any workaround that do the trick ?

Thank's !

1 Answers1

0

Some workaround would be open filepicker dialog inside filepicker in the same page. For mobile devices change filepicker.exportFile options:

filepicker.store(
    mycontent64,
    {base64decode: true, mimetype: 'text/plain'},
    function(InkBlob) {
        filepicker.exportFile(
            InkBlob,
            {
               suggestedFilename:"myfile.txt",
               extension: ".txt"
               container: "yourIframeId",
               mobile: true
            },
        function(InkBlob) {
        // ******* Save file
        },
        function(FPError) {
            console.log(FPError.toString());
        });
        },
    function(FPError) {
            console.log(FPError.toString());
    }
);

"yourIframeId" is Id of iFrame tag inside your website. 'mobile: true' will force mobile - responsive version of dialog. Check docs: https://developers.filepicker.io/docs/web/#export

krystiangw
  • 529
  • 5
  • 14