According to this post, I should be able to get a userscript to work in an iframe simply by specifying a match URL. However, it does not work for me in case of the iframe for Facebook like button embedded on - say - codeforces.com
.
As an MVCE, here's a small script:
// ==UserScript==
// @name Bug test
// @version 0.1
// @author Gaurang Tandon
// @match https://codeforces.com/*
// @match https://www.facebook.com/v2.8/plugins/like.php
// @match https://www.facebook.com/v2.8/plugins/like.php/
// @match https://www.facebook.com/v2.8/plugins/like.php/*
// ==/UserScript==
(function() {
'use strict';
console.log(window.location.hostname);
}();
Loading this on codeforces.com gives only one log statement in DevTools Console and that is codeforces.com
. Removing one or two of those @match
directives changes nothing.
Why does the script not run in that iframe?