Hello everyone! I have a question that has plagued me for months. If you can help, I will love you forever. Really. Here it is...I need to resize an iframe from WITHIN the iframe. In other words, the iframe loads myFunctions.js, which contains a function that can resize the iframe. I can''t find ANY way to do this using prototype, jquery, js, etc... Note that I can''t access the parent window since it''s loaded via a different domain. How might this be accomplished in Prototype or any other framework? Thanks, Rich --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
mmmm to change the height of an iframe to fit its inside content you could
do something like...
top.$(''ID_OF_IFRAME'').height = top.window.frames
[''NAME_ATTRIBUTE_OF_IFRAME''].document.body.scrollHeight;
you could also do
top.$(''ID_OF_IFRAME'').height
top.$(''ID_OF_FRAME'').contentDocument.body.scrollHeight;
...but contentDocument dosen''t work in IE =\
dunno if this is the best way but etc. etc.
On Tue, Mar 18, 2008 at 4:05 PM, rinogo
<ricosuave-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> Hello everyone!
>
> I have a question that has plagued me for months. If you can help, I
> will love you forever.
>
> Really.
>
> Here it is...I need to resize an iframe from WITHIN the iframe. In
> other words, the iframe loads myFunctions.js, which contains a
> function that can resize the iframe. I can''t find ANY way to do
this
> using prototype, jquery, js, etc... Note that I can''t access the
> parent window since it''s loaded via a different domain.
>
> How might this be accomplished in Prototype or any other framework?
>
> Thanks,
> Rich
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Isn''t top inaccessible in a cross-domain environment, though? For example, I have the main (top) window, which we''ll call A. Then, within A, I have an iframe B. iframe B is loaded from a different domain than the domain from which the main window A is loaded. From JS included by iframe B, I need to resize iframe B. Given cross- domain restrictions, I can''t access A from B. This includes using ''top'', wouldn''t it? tia, -Rich On Mar 18, 5:23 pm, "David Lam" <david.k.l...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> mmmm to change the height of an iframe to fit its inside content you could > do something like... > > top.$(''ID_OF_IFRAME'').height = top.window.frames > [''NAME_ATTRIBUTE_OF_IFRAME''].document.body.scrollHeight; > > you could also do > > top.$(''ID_OF_IFRAME'').height > top.$(''ID_OF_FRAME'').contentDocument.body.scrollHeight; > > ...but contentDocument dosen''t work in IE =\ > > dunno if this is the best way but etc. etc. > > On Tue, Mar 18, 2008 at 4:05 PM, rinogo <ricosu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hello everyone! > > > I have a question that has plagued me for months. If you can help, I > > will love you forever. > > > Really. > > > Here it is...I need to resize an iframe from WITHIN the iframe. In > > other words, the iframe loads myFunctions.js, which contains a > > function that can resize the iframe. I can''t find ANY way to do this > > using prototype, jquery, js, etc... Note that I can''t access the > > parent window since it''s loaded via a different domain. > > > How might this be accomplished in Prototype or any other framework? > > > Thanks, > > Rich--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
ohhh lol i totally missed the resize iframe from within an iframe part... no idea... but maybe window.parent? On Tue, Mar 18, 2008 at 4:47 PM, rinogo <ricosuave-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Isn''t top inaccessible in a cross-domain environment, though? For > example, I have the main (top) window, which we''ll call A. Then, > within A, I have an iframe B. iframe B is loaded from a different > domain than the domain from which the main window A is loaded. From > JS included by iframe B, I need to resize iframe B. Given cross- > domain restrictions, I can''t access A from B. This includes using > ''top'', wouldn''t it? > > tia, > -Rich > > On Mar 18, 5:23 pm, "David Lam" <david.k.l...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > mmmm to change the height of an iframe to fit its inside content you > could > > do something like... > > > > top.$(''ID_OF_IFRAME'').height = top.window.frames > > [''NAME_ATTRIBUTE_OF_IFRAME''].document.body.scrollHeight; > > > > you could also do > > > > top.$(''ID_OF_IFRAME'').height > > top.$(''ID_OF_FRAME'').contentDocument.body.scrollHeight; > > > > ...but contentDocument dosen''t work in IE =\ > > > > dunno if this is the best way but etc. etc. > > > > On Tue, Mar 18, 2008 at 4:05 PM, rinogo <ricosu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hello everyone! > > > > > I have a question that has plagued me for months. If you can help, I > > > will love you forever. > > > > > Really. > > > > > Here it is...I need to resize an iframe from WITHIN the iframe. In > > > other words, the iframe loads myFunctions.js, which contains a > > > function that can resize the iframe. I can''t find ANY way to do this > > > using prototype, jquery, js, etc... Note that I can''t access the > > > parent window since it''s loaded via a different domain. > > > > > How might this be accomplished in Prototype or any other framework? > > > > > Thanks, > > > Rich > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Tue, Mar 18, 2008 at 7:47 PM, rinogo <ricosuave-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Isn''t top inaccessible in a cross-domain environment, though? For > example, I have the main (top) window, which we''ll call A. Then, > within A, I have an iframe B. iframe B is loaded from a different > domain than the domain from which the main window A is loaded. From > JS included by iframe B, I need to resize iframe B. Given cross- > domain restrictions, I can''t access A from B. This includes using > ''top'', wouldn''t it?hmmm, javascript aside, ive not dealt w/ this problem myself, but im curious. would you be able to proxy the site you are showing in B on the server that renders A? then you could circumvent the cross domain limitation and should be able to do the resizing.. -nathan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
> top.$(''ID_OF_IFRAME'').height > top.$(''ID_OF_FRAME'').contentDocument.body.scrollHeight; > > ...but contentDocument dosen''t work in IE =\maybe this? top.$(''ID_OF_IFRAME'').height = top.$ (''ID_OF_FRAME'').contentWindow.document.body.scrollHeight; --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
@Nathan: Yes, we *would* be able to do that, but the host site (A) is a Yahoo store, which gives us essentially zero server-side control... :( @Rauan: Unfortunately, given the cross-domain environment, we don''t have access to A from B (which is what we need if we''re to use ''top''). Any other ideas? Thanks for your help, all! If we can figure out how to do this, it might be a first - I haven''t seen record of this anywhere on the ''net. -Rich On Mar 19, 8:33 am, Rauan Maemirov <rauan1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > top.$(''ID_OF_IFRAME'').height > > top.$(''ID_OF_FRAME'').contentDocument.body.scrollHeight; > > > ...but contentDocument dosen''t work in IE =\ > > maybe this? > > top.$(''ID_OF_IFRAME'').height = top.$ > (''ID_OF_FRAME'').contentWindow.document.body.scrollHeight;--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Ok, so here''s a bit more information about the problem: We don''t necessarily have to resize the iframe per se...All we''re trying to do is hide it. So, any method will work (changing the visibility attribute, changing the z-order, etc.) Here''s essentially what we''re doing: The main host page (A) contains an iframe (B). B is initially hidden (or very small so it cannot be seen (1x1 px), at a z-order behind A, etc). At any given time (when triggered by the script), B shows *itself*, occupying the entire window. Then, at B''s discretion (triggered by a script within B), B hides *itself*, returning to the initial state. Note that this would normally be a trivial exercise, except that A and B are hosted on different domains, so B can''t communicate with A for help with showing/hiding/changing attributes/ etc. Any thoughts on different ways to accomplish this? tia, -Rich On Mar 19, 9:29 am, rinogo <ricosu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> @Nathan: > Yes, we *would* be able to do that, but the host site (A) is a Yahoo > store, which gives us essentially zero server-side control... :( > > @Rauan: Unfortunately, given the cross-domain environment, we don''t > have access to A from B (which is what we need if we''re to use > ''top''). Any other ideas? > > Thanks for your help, all! If we can figure out how to do this, it > might be a first - I haven''t seen record of this anywhere on the ''net. > > -Rich > > On Mar 19, 8:33 am, Rauan Maemirov <rauan1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > top.$(''ID_OF_IFRAME'').height > > > top.$(''ID_OF_FRAME'').contentDocument.body.scrollHeight; > > > > ...but contentDocument dosen''t work in IE =\ > > > maybe this? > > > top.$(''ID_OF_IFRAME'').height = top.$ > > (''ID_OF_FRAME'').contentWindow.document.body.scrollHeight;--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---