高图表导出在安卓网络视图中不起作用


High chart export not working in android webview

谁能帮我弄清楚为什么高图表导出(下载png)功能在移动浏览器中不起作用?当我在移动浏览器中尝试其演示 http://www.highcharts.com/demo 并且它工作正常时。请帮助我。

编辑这里是导出的代码.js负责文件下载 -

  f.post(a.url, {
            filename: a.filename || "chart",
            type: a.type,
            width: a.width || 0,
            scale: a.scale || 2,
            svg: e
        },

谢谢。

我是通过技巧做到的,可能它对你也有用,所以我下载了 export.js 并将其修改为 -

exportChart: function(t, e) {
        var n = this.getSVGForExport(t, e),
            t = u(this.options.exporting, t),
            o = {
                filename: t.filename,
                type: t.type,
                width: t.width || 0,
                scale: t.scale || 2,
                svg: n,
                async: !0
            };
        $.post(t.url, o, function(e) {
            var n = t.url + e,
                o = document.URL,
                i = "chartUrl",
                r = n,
                a = new RegExp("([?&])" + i + "=.*?(&|$)", "i"),
                s = -1 !== o.indexOf("?") ? "&" : "?";
            o.match(a) ? currentUrl = o.replace(a, "$1" + i + "=" + r + "$2") : currentUrl = o + s + i + "=" + r, window.open(currentUrl, "_self")
        })
    },

在安卓方面,我有以下代码 -

f (url != null) { //url = current web url
String arr[] = url.split("=");
if (arr != null && arr.length == 2) {
    String newUrl = arr[1];
    if (newUrl != null && !newUrl.equals("")) {
        String fileName = newUrl.substring(newUrl.lastIndexOf('/') + 1, newUrl.length());
        Toast.makeText(context, "Start Downloading...", Toast.LENGTH_LONG).show();
        Log.i(getClass().getName(), "newUrl : " + newUrl);
        DownloadManager.Request request = new DownloadManager.Request(Uri.parse(newUrl));
        request.allowScanningByMediaScanner();
        request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
        request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName);
        DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
        dm.enqueue(request);
    }
}}