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
  • 86,878
  • 22
  • 220
  • 282
Martin
  • 1,947
  • 6
  • 25
  • 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
  • 86,878
  • 22
  • 220
  • 282
derjanb
  • 970
  • 9
  • 13