INNER CODE UNIT · JavaScript

download

mikepenz/AboutLibraries · DEV/definition-file-builder/js/download.js:1

function download(strData, strFileName, strMimeType) {
	var D = document,
		a = D.createElement("a");
		strMimeType= strMimeType || "application/octet-stream";

	if (navigator.msSaveBlob) { // IE10+
		return navigator.msSaveBlob(new Blob([strData], {type: strMimeType}), strFileName);
	} /* end if(navigator.msSaveBlob) */



	if ('download' in a) { //html5 A[download]
		if(window.URL){
			a.href= window.URL.createObjectURL(new Blob([strData]));
			
 		}else{
			a.href = "data:" + strMimeType + "," + encodeURIComponent(strData);
		}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…