Hello
I want to create an vCard - Export - Button. The first step is to collect all information needed and write them in an extra text field. It's all set up with the right tags for a vCard like the Definition.
Then I found a JavaScript, which can create a text file. There I changed the file ending to vcf. The problem now is, that the file is exported in UTF-8. When I import the vcf in Outlook, the ä ö and ü are ö or ü.
How can I export the File in Windows-1252? I really tried everything for MimeType.
function onClick() {
var filename = Xrm.Page.getAttribute("fullname").getValue();
var Content = Xrm.Page.getAttribute("eis_vcard").getValue();
download(Content, filename + ".vcf", 'text/vcard;");
}
function download(strData, strFileName, strMimeType, encoding) {
var D = document,
a = D.createElement("a");
strMimeType = strMimeType || "application/octet-stream";
if (navigator.msSaveBlob) { // IE10
return navigator.msSaveOrOpenBlob(new Blob([strData], { encoding: encoding, type: strMimeType }), strFileName);
} /* end if(navigator.msSaveBlob) */
if ('download' in a) { //html5 A[download]
a.href = "data:" + strMimeType + "," + encodeURIComponent(strData);
a.setAttribute("download", strFileName);
a.innerHTML = "downloading...";
D.body.appendChild(a);
setTimeout(function () {
a.click();
D.body.removeChild(a);
}, 66);
return true;
} /* end if('download' in a) */
//do iframe dataURL download (old ch+FF):
var f = D.createElement("iframe");
D.body.appendChild(f);
f.src = "data:" + strMimeType + "," + encodeURIComponent(strData);
setTimeout(function () {
D.body.removeChild(f);
}, 333);
return true;
} /* end download() */
*This post is locked for comments
I have the same question (0)