Steps to reproduce
Saving a blob to a file with “.xml” extension does not work. Changing the code below to save to a file with .txt works.
var data = "<?xml version=’1.0’ encoding=’UTF-8’?>";
// 1. this will give “test.xml couldn’t be downloaded error”
navigator.msSaveBlob(new Blob([data], “text/xml”), “test.xml”);
// 2 this will give “test.xml couldn’t be downloaded error”
let a = document.createElement(‘a’);
a.href = window.URL.createObjectURL(new Blob([data], “text/xml”));
a.download = "test.xml";
Comments and activity
- Microsoft Edge Team
Changed Assigned To to “Steven K.”
Have you tried using window.navigator.msSaveBlob()?
(["<?xml version=’1.0’ encoding=’UTF-8’?>
I have attached my complete example. Here is the link I used as a reference.
Let me know what you find,
Yes I did, as you can see in the example above I have tried both: 1. Using msSaveBlob & 2. Using a link. Same error in both cases
In your example, you are using navigator.msSaveBlob. That is for IE, I believe.
Can you run the repro I attached and let me know the results?
If I run index.html by clicking the attachment -> works
If I save index.html to desktop first before running it -> fails
Perhaps there is a file permission issue? Can you make sure the downloaded and saved ‘index.html’ is unblocked? I have attached a screenshot of the unlock option. Right click on the file and select properties to get to this screen.
It’s definitely not blocked since I can change the extension back and forth “.xml” not working, “.txt” working.