Cross Domain iframe Resizing

Hello Experts,

Here's a fun one... I'm trying to implement this: 

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:
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:

The iframe on this page points to a simple url:, 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 (, 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:, you will see that the iframe loads 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??

NWCenter IT
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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".
stu29Author Commented:
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
Michel PlungjanIT ExpertCommented:
1. you have       console.log(frameId);
Error: console is not defined
Source File:
Line: 7

2. you try to get the location of the top url, take whatever is after the hash and load that. But the top URL never changed when you clicked the link
You need to pass the topurl to the iframe when the test.html is clicked

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
stu29Author Commented:
Pointed me i nthe correct direction ... thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.