【问题标题】:when I try to zip apiece of html to separated page and zip it not work [closed]当我尝试将一段 html 压缩到单独的页面并压缩它时不起作用 [关闭]
【发布时间】:2022-02-04 18:09:57
【问题描述】:

当我尝试将一段 HTML 下载到单独的页面并使用 java 脚本对其进行压缩时,它无法正常工作

var zip = new JSZip();

var html = $("#editor")[0].innerHTML;

zip.file("extraction.html", html);

jQuery("#cmd").on("click",
function() {
    debugger;
    zip.generateAsync({
        type: "base64"
    }).then(function(base64) {
        window.location = "data:application/zip;base64," + base64;
    },
    function(err) {
        debugger;
        jQuery("#data_uri").text(err);
    });
});

【问题讨论】:

    标签: javascript html jquery


    【解决方案1】:

    当我更换 zip.file("extraction.html", html);zip.file("extraction.html", html, "text/html"); 问题解决了

    【讨论】:

      猜你喜欢
      • 2016-03-15
      • 2019-03-23
      • 2023-04-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-03
      相关资源
      最近更新 更多