We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Downloading option is not supported in Safari, Please use the returned data

Hi,

We have some Safari users (actually a growing number) trying to export their diagrams and receiving the following message:

"Downloading option is not supported in Safari, Please use the returned data"

What does that mean?
What do I have to do to allow the user to export/download the diagram?

I find the following in your documentation under the Diagram control:

"In IE-9, Diagrams cannot be exported as downloadable files. Instead, Diagram provides the exported data (DataURL/SVG) that enables to export it from application."

This sounds similar to the Safari issue.

Some guidance and code snippets would be much appreciated.

Thanks

Jim

3 Replies

SG Shyam G Syncfusion Team August 31, 2016 06:54 AM UTC

Hi Jim, 
 
By default for exporting diagram into image format, IE-9 and safari browser doesn’t support to download files with specific name and file type. You can get the data URL by using the client side API method ‘’exportDiagram” and export it in the application level. Please refer to the KB link for more details. 
 
 
Regards, 
Shyam G 



JJ Jim Jacobs August 31, 2016 03:23 PM UTC

Hi Shyam,

I made some minor tweaks to the sample that you provided but I'm still getting the same message.
I've attached a screenshot - the console message I write can be seen there.

I'm running Safari version 9.1.2 (11601.7.7) on OS X El Capitan Version 10.11.6

I detect Safari and then call the following function (from your sample).
I added region: "pageSettings" - although this has no effect on the export.

    function exportDiagramInSafari(imgType, downloadFileName) {
    // Function provided by Syncfusion for exporting diagrams from Safari
    console.log('Entering exportDiagramInSafari - imgType: ' + imgType + ' downloadFileName: ' + downloadFileName);
    var content = diagram.exportDiagram({
        fileName: downloadFileName, region: "pageSettings",
        mode: "download"
    });
    content = content.replace(/^data:[a-z]*;,/, '');
    var image1 = content.split(',');
    var byteString = atob(image1[1]);
    var buffer = new ArrayBuffer(byteString.length);
    var intArray = new Uint8Array(buffer);
    for (var i = 0; i < byteString.length; i++) {
        intArray[i] = byteString.charCodeAt(i);
    }
    var blob = new Blob([buffer], { type: 'application/octet-binary' });
    var pom = document.createElement('a');
    var url = URL.createObjectURL(blob);
    pom.rel='nofollow' href = url;
    //safari doesn't support download attribute and it takes fileName and filetype as unknown.
    var fileName = downloadFileName, fileType = imgType;
    pom.setAttribute('download', fileName + '.' + fileType);
    if (document.createEvent) {
        var e = document.createEvent("MouseEvents");
        e.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
        pom.dispatchEvent(e);
    } else if (pom.fireEvent) {
        pom.fireEvent("onclick");
    }
}

Any suggestions?

Thanks

Jim


Attachment: Screen_Shot_20160831_at_9.28.40_AM_8666d868.zip


SG Shyam G Syncfusion Team September 1, 2016 11:52 AM UTC

Hi Jim, 

As mentioned, We cannot directly download the files in safari browser. You can get the data URL from the exportDiagram method and process it in the application level. Please look into the below video in which we have demonstrated how to download the files in safari browser. 


Also please check whether you get the data from the blob as shown in the below code example. If you have not received any data from the blob, then you need to refer the blob JavaScript file(blob.js). We have referred blob JavaScript file in the below sample. You can check the below sample for reference. 

Code example: 
var blob = new Blob([buffer], { type: 'application/octet-binary' });  


Regards, 
Shyam G 


Loader.
Up arrow icon