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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

125647 Aug 30,2016 03:23 PM Sep 1,2016 07:52 AM JavaScript 3
loading
Tags: ejDiagram
Jim Jacobs
Asked On August 30, 2016 03:23 PM

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

Shyam G [Syncfusion]
Replied On August 31, 2016 02:54 AM

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 


Jim Jacobs
Replied On August 31, 2016 11:23 AM

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

Shyam G [Syncfusion]
Replied On September 1, 2016 07:52 AM

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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;