3

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?

Brock Adams
  • 90,639
  • 22
  • 233
  • 295
Martin
  • 2,007
  • 6
  • 28
  • 44

1 Answers1

2

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

Brock Adams
  • 90,639
  • 22
  • 233
  • 295
derjanb
  • 1,020
  • 10
  • 13