From 3b597fd8532b5a2eb9e50be94fd79dd8b6149870 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 26 Sep 2021 20:33:03 -0600 Subject: [PATCH] Correct media type for JSON and encode reserved chars --- src/en/examples/vector/download.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/en/examples/vector/download.js b/src/en/examples/vector/download.js index f51661fb..b36809e7 100644 --- a/src/en/examples/vector/download.js +++ b/src/en/examples/vector/download.js @@ -63,6 +63,7 @@ const download = document.getElementById('download'); source.on('change', function () { const features = source.getFeatures(); const json = format.writeFeatures(features); - download.href = 'data:text/json;charset=utf-8,' + json; + download.href = + 'data:application/json;charset=utf-8,' + encodeURIComponent(json); }); //! [download]