Configuration files in Greasemonkey script

From what I understand, reading files using Greasemonkey is not possible. I need to define many static configuration files, and it seems completely messy to include those that are directly in the user script.

So what is the best way to store and retrieve this data?

+3
source share
3 answers

Yes, it is impossible, by design, to read local files .

If your files have a whole page or text and do not change often, use GM_getResourceText(), to Dr. Mollet's answer.

, GM_xmlhttpRequest(), , . . 2 .


  • GM_getResourceText() - . , (, 1 ), , , , , Ajax - 150 (!!!) .

    : , . (EG: C:\Documents and Settings\<Windows login/user name>\Application Data\Mozilla\Firefox\Profiles\<profile folder>\gm_scripts\YOUR_SCRIPT_NAME\)

  • - - , GM_xmlhttpRequest() script.

    , -, Google.

  • GM_getValue() globalStorage ( , ). , ( , ).

  • @require GM_getResourceText(), JavaScript. , script , , .
    .

+5

Or you can download it automatically using @require

0
source

All Articles