Talk:Content Scope Runner

From GreaseSpot Wiki
Revision as of 06:34, 25 July 2010 by Phyzome (talk | contribs) (This works)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

What is it about this technique that stops execution of the remainder of the script?

Yeah, it fails to do that. I'm going to experiment a bit to see if I can fix that. -- Phyzome 05:31, 25 July 2010 (UTC)

Here, this actually works, but only when inlined in a script:

if(typeof __PAGE_SCOPE_RUN__ == 'undefined') {
   (function page_scope_runner() {
      var script = document.createElement('script');
      script.setAttribute("type", "application/javascript");
      script.textContent = "(function() { var __PAGE_SCOPE_RUN__ = 'yes'; (" + page_scope_runner.caller.toString() + ")(); })();";
      document.documentElement.appendChild(script);
      document.documentElement.removeChild(script);
   })();
   return;
}

-- Phyzome 06:34, 25 July 2010 (UTC)