多个版本的html2canvas

Multiple versions of html2canvas

我将 html2canvas 的版本从 v0.5.0 更新到 v1.0.0,然后某个功能在 iOS.

上停止工作

所以,我想在 iOS 上使用 v0.5.0,在其他设备上使用 v1.0.0。

如何在我的网络应用程序上同时拥有和使用两个版本的 html2canvas?

尝试编写自定义函数。

 (function (w, d) {
        "use strict";
        var h = d.getElementsByTagName("head")[0],
            s = d.createElement("script");
        w.d3 = null;
        s.src ="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.5.0/html2canvas.min.js";
        s.onload = function () {
            w.d3_3_5_3 = w.d3;
            w.d3 = undefined;
            s = d.createElement("script");
            s.src ="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.5.0/html2canvas.min.js";
            s.onload = function () {
                w.d3_3_5_4 = w.d3;
                w.d3 = undefined;
                s = d.createElement("script");
                s.src = "https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.0.0/html2canvas.min.js";
                s.onload = function () {
                    w.d3_3_5_5 = w.d3;
                    w.d3 = undefined;
                };
                h.appendChild(s);
            };
            h.appendChild(s);
        };
        h.appendChild(s);
    }(window, document));

希望对您有所帮助!