Search in sources :

Example 1 with Global.encodeURIComponent

use of elemental2.core.Global.encodeURIComponent in project kie-wb-common by kiegroup.

the class HTMLDownloadHelper method download.

public void download(final String filename, final String html) {
    final String sourceHTML = HEADER + html + FOOTER;
    final String source = Global.encodeURIComponent(sourceHTML);
    final HTMLAnchorElement fileDownload = (HTMLAnchorElement) document.createElement("a");
    document.body.appendChild(fileDownload);
    fileDownload.href = ENCODING + source;
    fileDownload.download = filename + FILE_EXTENSION;
    fileDownload.onclick = (e) -> null;
    document.body.removeChild(fileDownload);
}
Also used : HTMLAnchorElement(elemental2.dom.HTMLAnchorElement)

Aggregations

HTMLAnchorElement (elemental2.dom.HTMLAnchorElement)1