W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2013

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

From: Leif Halvard Silli <xn--mlform-iua@xn--mlform-iua.no>
Date: Mon, 11 Mar 2013 07:46:25 +0100
To: whatwg@lists.whatwg.org
Message-ID: <20130311074625620330.9d5d7e4d@xn--mlform-iua.no>
Only Firefox sniffs the iframe doc of the following page as UTF-8:

   http://tinyurl.com/encodingmystery

   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
Received on Monday, 11 March 2013 06:46:53 GMT

This archive was generated by hypermail 2.3.1 : Monday, 11 March 2013 06:46:53 GMT