Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Iframes and Extracting Content

Status
Not open for further replies.

NigeW

Programmer
Jun 10, 2002
134
NZ
Hi there

I am working on a site that has an iframe. This iframe is retrieving data which is external to the website.

We want the iframe to resize based on the length of content within the iframe.

However as it is from an external source we cannot detect the length - browser security restrictions.

So one thought is :

1. Get the content of the iframe.
2. Copy content into a hidden iframe.
3. Detect the height of the hidden iframe.
4. Update the height of the visible iframe.

I cannot however find a way of extracting the content of the iframe.

Has anyone got any ideas ??

Thanks

Nigel Wilson
Christchurch Web Design
 
can't you capture the iFrame.src.innerHTML.length?

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
zen.gif

 
Hey mwolf00

Thanks for the reply.

I tried your suggestion but couldn't get that to work - I tried different object references (document.getElementById('framename').src.innerHTML.length) but no luck.

I will follow this up when back at work on Friday.

BTW - awesome graphic in your signature - did you make it yourself ?

Nigel Wilson
Christchurch Web Design
 
Hi cLFlaVA

As detailed in my first post we cannot resize the iframe due to the src of the iframe being from a source external to the website. I haven't investigated the actual security risks behind it but we have not been able to successfully resize the iframe - there is always an "Access Denied" type message.

Therefore I thought I might be able to capture the content of the iframe, populate it into a hidden local iframe , calculate the size of the local iframe, and then resize the iframe with the remote data in it.

Cheers

Nigel Wilson
Christchurch Web Design
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top