How can I prevent Tampermonkey from running on iframes?

E.g. I write a script for

// @include       http://*.youtube.com/*
// @include       https://*.youtube.com/*

The script will also run on external websites with embedded YouTube players. That's unneeded and even expensive when Tampermonkey fires 20 times on a page with 20 YT players.

How can I set the script to only fire when the surfed website is youtube.com?

有帮助吗?

解决方案

If your script really only runs at Tampermonkey (and/or Greasemonkey and/or Scriptish) you also can use the @noframes directive.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top