1

在greasemonkey javascript中,我需要从本地驱动器(例如c:驱动器)读取JSON数据文件。我怎么读?

尝试使用:- GM_getResourceText

// ==UserScript==
// @name            ####
// @version         1
// @grant           GM.xmlHttpRequest
// @grant           GM_getResourceText
// @include         https://www.#####
// ==/UserScript==

function ButtonClickAction() {
    GM.xmlHttpRequest({
        method: post,
        url: restURL,
        data: restJSONData,
        headers: {
            "Content-Type": "application/json"
        },
        onload: function(response) {
            console.log(response.responseText);        }
    });
}

restJSONdata,我需要从本地驱动器读取,因为它是一个大数据。

无法阅读它。

4

0 回答 0