Download JSON data Cross Browser Support specially IE

My customer has a need to provide download links for underlying data of Power BI Embedded report. The embedding worked is all worked fine on the public site page. We also provided the download links to download underlying data in CSV and JSON format. All worked fine but the download links did not work in IE11. After searching on web found this article which was so helpful and worked with no issues.

Download JSON data in CSV format Cross Browser Support -> https://ciphertrick.com/download-json-data-in-csv-format-cross-browser-support/

I will not repeat what is discussed in the above blog. However my need was to support JSON format file download as well. So I used the following code as shown in the blog.

IEwindow.document.execCommand(‘SaveAs’, true, fileName + “.json”);

The issue is that the file type .json was not liked by IE so it never saved this file. I am guessing something to do with the code as a JSON file. To save you the trouble please DO NOT use .json instead use something like this.

IEwindow.document.execCommand(‘SaveAs’, true, fileName + “.json.TXT“);

That line was OK for IE and it worked like a charm. I hope it is helpful to you.

 

About Pankaj

I am a Developer and my linked profile is https://www.linkedin.com/in/pankajsurti/
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s