mapbox / shp-write

create and write to shapefiles in pure javascript
BSD 3-Clause "New" or "Revised" License
290 stars 186 forks source link

problem with Internet Explorer #49

Closed ghassenrachid closed 10 months ago

ghassenrachid commented 7 years ago
function export_shp(){
    var tab_markers = export_map();
        var options = {
            types: {
                point: 'points',
                polygon: 'polygons',
                line: 'pipes'
            }
        }
        shpwrite.download({
            type: 'FeatureCollection',
            features: tab_markers
        }, options);    
}

my code work with chrome and firefox but when i use internet explorer the browser ask me if i want to allow the website to open an application on my computer when i allow it say "there is no application installed that can open this type of link (data)"

ghassenrachid commented 7 years ago

i think that the problem is when IE execute the MIME type application/zip

module.exports = function(gj, options) {
    var content = zip(gj, options);
    location.href = 'data:application/zip;base64,' + content;
};

i tried to use another MIME type from msdn.microsoft.com like application/x-zip-compressed but i have the same problem with IE

DemersM commented 6 years ago

For IE, there could be avantage to put the binary into a blob and use the navigator.msSaveBlob() function

https://stackoverflow.com/a/36899900/1914034

sheindel commented 10 months ago

This has been fixed in the latest tag (v0.4.0). Will be released on npm soon.

sheindel commented 10 months ago

Good news: v0.4.2 is now available.

Less good news: Mapbox changed their deployment organization so this package is now hosted under a different package

@mapbox/shp-write https://unpkg.com/@mapbox/shp-write@latest/shpwrite.js