This issue had been opened previously but no adequate solution was found
for inclusion inside GM, perhaps eventually something better will be found.
 Basically you need to make sure document.getElementsByTagName('head')[0]
exists, if it does not exist then you should wait a bit and check again,
once that exists you should be able to add styles successfully.  If it was
working for you previously then it's probably because the site was complex
enough to slow down processing of your script just enough that when the
script started to run <head> already existed in the document.

The issue was here: https://github.com/greasemonkey/greasemonkey/issues/1384

On Thu, May 31, 2012 at 3:52 PM, Matt Kruse <[email protected]> wrote:

> I've been using code with @run-at document-start, which calls
> GM_addStyle() to add CSS before the screen paints, thereby avoiding
> any flash of unstyled content. This was working well in Firefox 3.6.
>
> I recently updated to FF 12, and now I find that this no longer works.
> Calls to GM_addStyle() in document-start scripts fail silently, with
> no way to detect if it worked (that I can tell). I tested in Firefox
> 10 and 11 (portable) and see the same behavior.
>
> Is this a new limitation in Firefox? Does anyone know why it worked in
> previous versions?
> Barring any way to make it work, is there a way to *detect* if it
> failed, before DOMContentLoaded?
>
> For now, I'm going to add a wrapper function that will delay calls to
> GM_addStyle() until DOMContentLoaded, but I'd really like to have a
> way to insert the CSS before the page initially paints, to avoid ugly
> re-rendering when the styles kick in.
>
> Any thoughts?
> Thanks!
>
> Matt Kruse
>
> --
> You received this message because you are subscribed to the Google Groups
> "greasemonkey-users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/greasemonkey-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en.

Reply via email to