Link to home
Start Free TrialLog in
Avatar of stu29
stu29Flag for United States of America

asked on

Cross Domain iframe Resizing

Hello Experts,

Here's a fun one... I'm trying to implement this: http://css-tricks.com/cross-domain-iframe-resizing/ 

I've implemented in a very simple test environment and it works beautifully, well, maybe not beautifully, but it works.

The test environment is here: http://daniellehendrix.com/iframe.html
There is 1 issue with this page:

if you click the link at the top of the page to change the content of the iframe, the new page loads momentarily, but then redirects back to the original iframe content.

Here it is in action in a test page on the live site: http://www.nwcenter.org/taleo/jobs_jtd2.htm

The iframe on this page points to a simple url: http://tbe.taleo.net/NA12/ats/careers/searchResults.jsp, which loads fine.  The height resizes properly, but again the links to new pages don't work properly.  I believe this is because the links point to the same url (http://tbe.taleo.net/NA12/ats/careers/searchResults.jsp), with a search string on the end, like ?org=NWCENTER&cws=1&IsInFrame=yes&rid=301

This is interesting.  If you visit the other live test page: http://www.nwcenter.org/taleo/jobs_jtd.htm, you will see that the iframe loads http://tbe.taleo.net/NA12/ats/careers/searchResults.jsp?org=NWCENTER&cws=1&IsInFrame=yes which doesn't allow the iframe to resize.  I can't figure out why.  I have a hunch.

hunch: The JavaScript isn't taking into account the complex string at the end of the url.  It then can't parse the data being passed from the iframe when it resizes. kind of a bummer...

So, in conclusion, we have 2 problems.  1. linking to new pages in the iframe doesn't work. 2. the page won't resize when a complex url is loaded in the iframe.  It seems that these 2 problems go hand in hand.

Any ideas??

Thanks,
NWCenter IT
Avatar of scrathcyboy
scrathcyboy
Flag of United States of America image

I haven't looked at any of your links, but since there are no comments to your questions, and I have a lot of experience with Iframes, I will give you general guides.  Hope they help.

An iframe is simple a window in a master page where you place another web page into that window.  The iframe parameters can be rewritten from within the page (as long as it has an addressable ID or NAME).  But when you rewrite the parameters, you MUST first refresh the MASTER page that contains the iframe code before the iframe will show up with the new parameters you inserted.  However, when you refresh the master page, the HTML loading is the ORIGINAL Iframe parameters, not the ones you changed them to.

You have a conundrum, which may not be solvable.  You are trying to interactively change the iframe size, but the iframe size is dependent upon the code in the master page containing the iframe.  So I think you can see that you are fighting perhaps a catch 22 if you know what I mean.

I think you would be better using a relative position DIV to do what you want.  When you resize the DIV, you get instantaneous refreshing of that layer in the page, without needing to refresh the master page.  Try that, and I think you will see that iframes are superior elements, but not for in-line resizing.
Oh and concerning cross domain changing of one page in domain 1 from domain 2, remember that your domain 2 needs rewrite permissions on the domain 1 files.  This is NOT automatic, you have to develop a trust relationship between the two domains -- in most cases a shared certificate that both domains possess.  WIthout that certificate or other trust relationship, the changes you make from domain 2 into the pages on domain 1 may seem to work, but in fact, domain 1 actually ignores the changes as "never made".
Avatar of stu29

ASKER

Thanks for the reply.

But, as you said in your first sentence, "I haven't looked at any of your links", I don't think either of your comments really have anything to do with what we're after.  

Thanks for taking the time to respond, though.  If you have a minute to actually see what we're doing, we'd love to hear your thoughts.

-NWCenter IT
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of stu29

ASKER

Pointed me i nthe correct direction ... thanks