How to reload only a userscript, i.e. without reloading the page?

后端 未结 2 1873
青春惊慌失措
青春惊慌失措 2021-01-23 05:39

I\'m working on a Greasemonkey userscript for a web app that needs configuration steps before I can actually test my userscript\'s functionality. So every time I reload

2条回答
  •  无人及你
    2021-01-23 06:02

    Generally not feasible.

    As one of the collaborators remarked on this issue in GreaseMonkey's GitHub repo, almost all scripts mutate the page in ways that makes repeated script execution problematic.

    I overlooked this fact in my original question – my script does mutate the page in ways that makes repeated script execution problematic.

    If you want to implement script reload, and you find a feasible method to do that:

    • make sure you carefully evaluate what effect will it have on the page, and
    • implement clean-up code to prepare the page for the repeated execution of your script.

提交回复
热议问题