Sharing variables between 2 separate scripts [duplicate]

浪子不回头ぞ 提交于 2020-01-25 00:22:22

问题


I'm trying to share variable between 2 different Tampermonkey scripts running in 2 separate tabs.

I tried using GM_setValue in one script then retrieving it with GM_getValue in the other one but without any success, so I assume there's separate storage for each script.

Is there any easy way to do this? Am I just missing something simple? Can I somehow make both scripts share the same storage?


回答1:


Yes, you can. You can use localStorage, or you can use a database at your server and get/set values with AJAX.



来源:https://stackoverflow.com/questions/25949711/sharing-variables-between-2-separate-scripts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!