From: prabhjot singh on
Hey there,

I've a particular requirement in which I need to link stylesheets
already included in a parent html. In that HTML file, another iframe
is being on the fly and I need to link same stylesheets into the child
iframe. I can't link those stylesheets individually into the child
iframe because in the parent frame it is being included using an HTMLF
file (using java include directive).

I don't want to hardcode names of the individual stylesheets (as I'm
currently doing) in the child frame,

So, the options are

1.) Dynamically check the stylesheets linked to the parent frame and
link them to child frame

OR

2.) Need a way to include an HTMLF file using javascript.
From: rf on

"prabhjot singh" <er.prabhjots(a)gmail.com> wrote in message
news:1e50e01d-233c-4c75-9a18-150262c310fe(a)u41g2000yqe.googlegroups.com...
> Hey there,
>
> I've a particular requirement in which I need to link stylesheets
> already included in a parent html. In that HTML file, another iframe
> is being on the fly and I need to link same stylesheets into the child
> iframe. I can't link those stylesheets individually into the child
> iframe because in the parent frame it is being included using an HTMLF
> file (using java include directive).
>
> I don't want to hardcode names of the individual stylesheets (as I'm
> currently doing) in the child frame,
>
> So, the options are
>
> 1.) Dynamically check the stylesheets linked to the parent frame and
> link them to child frame
>
> OR
>
> 2.) Need a way to include an HTMLF file using javascript.

which is sometimes disabled. And then your "page" will be totally stuffed
up.

Include the CSS in each page referenced by an iframe, server side.


From: prabhjot singh on
On Jan 11, 5:14 pm, "rf" <r...(a)z.invalid> wrote:
> "prabhjot singh" <er.prabhj...(a)gmail.com> wrote in message
>
> news:1e50e01d-233c-4c75-9a18-150262c310fe(a)u41g2000yqe.googlegroups.com...
>
>
>
>
>
> > Hey there,
>
> > I've a particular requirement in which I need to link stylesheets
> > already included in a parent html. In that HTML file, another iframe
> > is being on the fly and I need to link same stylesheets into the child
> > iframe. I can't link those stylesheets individually into the child
> > iframe because in the parent frame it is being included using an HTMLF
> > file (using java include directive).
>
> > I don't want to hardcode names of the individual stylesheets (as I'm
> > currently doing) in the child frame,
>
> > So, the options are
>
> > 1.) Dynamically check the stylesheets linked to the parent frame and
> > link them to child frame
>
> > OR
>
> > 2.) Need a way to include an HTMLF file using javascript.
>
> which is sometimes disabled. And then your "page" will be totally stuffed
> up.
>
> Include the CSS in each page referenced by an iframe, server side.

For this case, you can assume that javascript will always be enabled.
I can't use server side include as the child iframe is being built on
the fly using a javascript function.
From: Scott Sauyet on
On Jan 11, 7:23 am, prabhjot singh <er.prabhj...(a)gmail.com> wrote:
> On Jan 11, 5:14 pm, "rf" <r...(a)z.invalid> wrote:
>> Include the CSS in each page referenced by an iframe, server side.
>
> For this case, you can assume that javascript will always be enabled.
> I can't use server side include as the child iframe is being built on
> the fly using a javascript function.

You can start with the document.styleSheets array in the parent
frame. But this is more difficult than you might like, because of
even greater than usual inconsistencies between browsers. Or perhaps
you can just list all the LINK elements with type="stylesheet" and all
the STYLE elements, copying them to the child frame. This certainly
sounds doable.

-- Scott
From: prabhjot singh on
On Jan 11, 5:48 pm, Scott Sauyet <scott.sau...(a)gmail.com> wrote:
> On Jan 11, 7:23 am, prabhjot singh <er.prabhj...(a)gmail.com> wrote:
>
> > On Jan 11, 5:14 pm, "rf" <r...(a)z.invalid> wrote:
> >> Include the CSS in each page referenced by an iframe, server side.
>
> > For this case, you can assume that javascript will always be enabled.
> > I can't use server side include as the child iframe is being built on
> > the fly using a javascript function.
>
> You can start with the document.styleSheets array in the parent
> frame.  But this is more difficult than you might like, because of
> even greater than usual inconsistencies between browsers.  Or perhaps
> you can just list all the LINK elements with type="stylesheet" and all
> the STYLE elements, copying them to the child frame.  This certainly
> sounds doable.
>
>   -- Scott

I need to bother about IE7 onwards only. Ok, I'll try copying the LINK
elements having type stylesheets into the child iframe, to see if it
helps.

Thanks for your help.