(Utilizo AngularJS)
Código:
Y este es el HTML .$scope.SaveToDisk = function (fileURL, fileName) { // for non-IE if (!window.ActiveXObject) { var save = document.createElement('a'); save.href = fileURL; save.target = '_blank'; save.download = fileName || 'unknown'; var event = document.createEvent('Event'); event.initEvent('click', true, true); save.dispatchEvent(event); (window.URL || window.webkitURL).revokeObjectURL(save.href); } // for IE else if ( !! window.ActiveXObject && document.execCommand) { var _window = window.open(fileURL, '_blank'); _window.document.close(); _window.document.execCommand('SaveAs', true, fileName || fileURL) _window.close(); } }
Código HTML:
<a ng-click="SaveToDisk(imagenLoca,'image.png')" class="btn btn-success"><strong>Descargar imagen</strong></a>
Desde ya, muchas gracias.