[whatwg] The iframe’s encoding only gets sniffed by Firefox - who is buggy?

Leif Halvard Silli xn--mlform-iua at xn--mlform-iua.no
Sun Mar 10 23:46:25 PDT 2013

Only Firefox sniffs the iframe doc of the following page as UTF-8:


   About that page:
1. It uses fallback encoding (Windows-1252).
2. The iframe doc is 100% document.write generated and
   contains the element <meta charset="UTF-8" />
3. The page contains a "mother script"[1] which triggers "ads
   rotation". The "mother script" e.g. causes the document.write
   script [2] to vary.
3. The iframe does not have any src attribute. Note therefore:
  a. In Firefox, the URL of the iframe doc is identical with the
     URL of the parent page (conclusion depends on the result of
     Ctrl-Click opening the iframe in another tab). 
  b. But in Safari etc, the URL of the iframe is 'about:blank'.

Firefox renders the iframe correctly no matter which ad rotation 
variant it sees. But in Safari, only 2 out of around 6 or more rotation 
variants renders correctly. Chrome behave like that as well. (I mention 
this because for iframe, only same-origin URL will allow iframe to 
inherit encoding from parent.)

Workaround found: On my own local network, by reducing the parent page 
to only the 'mother script',[1] plus adding charset="UTF-8" (<script 
charset="UTF-8" src="[1]"></script>) on the very script element that 
references that script, I was able to repair the problem in both 
Safari, Chrome and IE (but non in Opera/Presto). 

There is bug here, but I'm not sure whether the bug is in Firefox or 
the others. Why does Firefox work even without the @charset attribute 
on the <sript> - but not the others?

[1] http://tinyurl.com/motherscript
[2] http://tinyurl.com/DocumentWriteScriptOfThePage
leif halvard silli

More information about the whatwg mailing list