Optimal TM's way to store and retrive (remember) data for later use

Post Reply
Stelio.K
Posts: 2
Joined: 17.11.17 06:02:04

Optimal TM's way to store and retrive (remember) data for later use

Post by Stelio.K » 17.11.17 06:44:33

Hello, I've been a webdeveloper for years but new to TM.

I'm going to develop a script which use will be to aid the user on some tasks across pages which have in common a third party widget.

In order to do this I need this script to remeber things. Such things are alphanumeric data (strings) and possibily image files. This things must NOT be lost on browser's clear cache or browser reinstall possibily. But only by a TM's action supported by my script.

What's the best way to achive this with TM? I'd go with save/load into user's disk but I sense it could be troubled by security issues.

Thank you.

User avatar
derjanb
Site Admin
Posts: 2383
Joined: 20.01.06 02:16:15
Contact:

Re: Optimal TM's way to store and retrive (remember) data for later use

Post by derjanb » 17.11.17 17:11:13

GM_setValue and GM_getValue should work: http://tampermonkey.net/documentation.php?#GM_setValue

However, in case your profile gets corrupted there is nothing that Tampermonkey can do to preserve your data. Therefore you need to create backups. One way to achieve this is to backup your data via Options -> Utilities tab -> File/Zip Export. This will also backup the data stored via GM_setValue.

If you're using Chrome you can also backup your profile folder, because there are script to extract the data from such a backup: https://gist.github.com/derjanb/9f6c10168e63c3dc3cf0
ImageIf you like what I'm doing, please consider a donation here. Image


vr_burger
Posts: 2
Joined: 19.11.17 15:04:29

Re: Optimal TM's way to store and retrive (remember) data for later use

Post by vr_burger » 19.11.17 17:51:50

you can also send data to a local database via php or use other tricks

Post Reply