Iframe undefined in greasemonkey script

I created a Greasemonkey script that works fine in the firebug editor, with the exception of Greasemonkey features, but not when I try to pack it as a custom one. The Firefox Error Console reports that the iframe I'm trying to use is undefined.

I have reduced the registration number to the minimum case where it should print the iframe html to the firebug console and is executed when it starts in the firebug editor, but it does not work as usercript:

// ==UserScript==
// @name          Movies
// @include       http://*.princecharlescinema.com/*
// @include       http://princecharlescinema.com/*
// ==/UserScript==

// stop script loading multiple times
if (top !=self) return;

var iframeHTML = window.frames['iframe2'].document.documentElement.innerHTML;
unsafeWindow.console.log(iframeHTML);

An example script page is for

If it makes any sense to use a full script, I collect all the td tags from this iframe, get some information from them, and then insert some new html into the same td tags.

Any help would be appreciated.

+5
1

, DOMFrameContentLoaded

0

All Articles