Apply a Greasemonkey/Tampermonkey/userscript to an iframe?

前端 未结 3 1613
误落风尘
误落风尘 2020-11-30 07:44

The title is pretty much the question:

Is it possible to add a Greasemonkey script to an iframed website?

If so, how?

Thank you.

3条回答
  •  猫巷女王i
    2020-11-30 08:13

    Note that if you're making a chrome extension for your userscript, you also need to add "all_frames": true to your manifest or your extension won't work on iframes.

    Example from manifest file:

    "content_scripts": [
        {
          "matches": ["*://*/*"],
          "all_frames": true,
          "js":["dont.js"],
          "run_at":"document_start"
        }
      ]
    

    Example use case: https://github.com/NavinF/dont

提交回复
热议问题