Hi Louis,

2011/3/10 Louis-Rémi Babé <[email protected]>

> Hello everybody,
>
> I'm pretty sure it shouldn't be possible for an iFrame loaded from a
> different domain to access the content of the parent document.
>

That's right.



> I'm wondering how Firebug-lite manages to do exactly that...
> Is there some kind of magic involved? Something similar to dojo's
> windowName transport or am I missing something much simpler?
>

We're not using a different domain. That's the trick.

We create an iframe with "about:blank" src. Then we use the good old
iframe.contentWindow.document.write() and inject both HTML and CSS content
(remember to also call document.close()).

See the createChromeWindow() function:

http://code.google.com/p/fbug/source/browse/lite/branches/firebug1.4/content/firebug/chrome.js#163

The "useLocalSkin" variable will be "false" in this case (when loading
Firebug Lite via an external URL).

The HTML / CSS injection happens here:
http://code.google.com/p/fbug/source/browse/lite/branches/firebug1.4/content/firebug/chrome.js#341

        //* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * *
        // Inject the interface HTML if it is not using the local skin

        if (!useLocalSkin)
        {
            var tpl = getChromeTemplate(!isChromeFrame),
                doc = isChromeFrame ? node.contentWindow.document :
node.document;

            doc.write(tpl);
            doc.close();
        }


If you need help understanding the code, just post another message here.

regards,

Pedro Simonetti.



> Thank you in advance,
>
> Louis-Rémi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Firebug" 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/firebug?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Firebug" 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/firebug?hl=en.

Reply via email to