私のアプリではGeoJSONを.jsonファイルとしてエクスポートすることができます。ダウンロードはChromeとFirefoxではうまくいきますが、Safariではdata:text/ + GEOJSON STRING
GeoJSONのテキストがページに表示されます。ダウンロードは一切ありません。Safari - データのエクスポート/ htmlダウンロードの属性が無効です
$('#export_table > tbody > tr > td').each(function(){
geoObject = JSON.parse($(this).html());
layerName = geoObject.name;
exportRowToGeoJSON($(this).html(), layerName);
});
function exportRowToGeoJSON(storageObj, fileName){
dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(storageObj);
link = document.createElement('a');
link = document.body.appendChild(link); //FOR FIREFOX
link.setAttribute("href", dataStr);
link.setAttribute("download", fileName + ".json");
link.click();
};
そうではなく、それは他のブラウザの場合と同様href
datasStr
のダウンロードをトリガー、Safariはリンク先のURLとしてhref
属性を扱います。
Chrome、Firefox、Safariで正しく機能する方法はありますか?あなたが見ることができるように
filesaver.js "library"を試す –
http://stackoverflow.com/questions/38711803/how-to-download-a-file-without-using-a-element-with-download-attribute-or -a-se – guest271314