Tricky IFrame Problem (yes it's about the dynamic height, again)

F

f.ruecker

Hey Guys,
I've done my research for a script that dynamically adjusts the height
of the Iframe, but none of the scripts have the features, which I all
need. Maybe one of you can help me:

1. The site contained in the Iframe is no on the same Domain nor Server
as the main page

2. I can't put any code in the Iframe (YES, I do have permission to
include the Iframe ;-)

3. The height needs to adjust not just the first time the mainpage
loads, but also everytime somebody opens a new site in the Iframe. The
height needs to be readjusted in that case, too.

If the script works for IE only, it'll be better than nothing (as long
as it works for other browsers with scrollbars) and if it works for IE
and Mozilla only I'm good.

Alright.. I hope somebody can help me. I'd be veeeeery grateful.
Thanks.
Flo from Berlin.
 
A

ASM

(e-mail address removed) a écrit :
3. The height needs to adjust not just the first time the mainpage
loads, but also everytime somebody opens a new site in the Iframe. The
height needs to be readjusted in that case, too.

needs to adjust to *what* ?

any way you can have an 'onload' in the tag of your iFrame.

The only question is how to get informations about a page coming from
other domain.
If the script works for IE only,

Some browsers don't accept to adjust content of their iframes when
taller resized ... :-(

I think you must know previously which height to give to the iFrame
before to send it the new (other) site.


..
 
S

scriptguru

Hi Flo!
Sorry, but for a security reasons browsers have a restriction: you
can't access iframe's content with page from other domain (and if you
can't access it you can't know the size of the iframe's content).

Val Polyakh
http://trickyscripter.com
 
F

f.ruecker

Sorry, but for a security reasons browsers have a restriction: you
can't access iframe's content with page from other domain

I'm quite sure, that there are scripts that make an Iframe adjust it's
height to the content of an off-domain-site but these scripts didn't
have both of the other needed features..

Is there an alternative to Iframes that would get me to my goal? (And
no, I can't include the page via PHP).

Thanks guys.
Flo.
 
S

scriptguru

(e-mail address removed) напиÑав:
I'm quite sure, that there are scripts that make an Iframe adjust it's
height to the content of an off-domain-site but these scripts didn't
have both of the other needed features..

I am 100% sure you can't access document of the off-domain-site through
iframe. It is standart security policy. If you don't believe - please
read info about cross-domain security at MS and Mozilla sites.
Is there an alternative to Iframes that would get me to my goal? (And
no, I can't include the page via PHP).

I see only one solution. You need server-side proxy script. This script
just reads page from another site and places it to your iframe. Then
you can access and modify this iframe.
If you can't use server side scripting I believe that you might think
about totally different solution (maybe without iframes or without
resize of iframes).

Val Polyakh
http://trickyscripter.com
 
K

Kevin Darling

Hey Guys,
I've done my research for a script that dynamically adjusts the height
of the Iframe, but none of the scripts have the features, which I all
need. Maybe one of you can help me:

I'm curious. Even if you could access the iframe source, how would you
know what height to make the iframe resize to? Is the idea to get rid
of vertical scrollbars or something?

Thanks!
Kev
 
F

fran.carstens

I'm struggling with the same issue. Closest I've come was with script
found at:

http://guymal.com/mycode/iframe_size.shtml

It's a bit buggy, but it works. (I've tested it on IE6 Win, Camino Mac,
Netscape Mac, Opera Mac - all work.)

On my test page I tried loading cnn.com and google, and both open. (see
here: http://www.lightbulb.co.za/oostco/trackertest.html)

The links to CNN and Google are obviously for testing purposes only...
but it works - cross domain.)

** If you get to fix the "double size" issue in IE, that would be
great, let me know what the code should be. **

Francois.
 
F

fran.carstens

Before I continue... there is a problem i just found - that subsequent
pages don't resize correctly. The problem here is probably that the
script can not receive page size information from out of domain pages.
The resize works for pages hosted on my domain, but fails to resize
correctly for google and cnn. Some more hunting.

(On the other hand - if you can tweak the files you're calling in order
to tell the script their size - you're halfway there.)

Francois.
 
F

f.ruecker

Francois said:
Before I continue... there is a problem i just found - that subsequent
pages don't resize correctly. The problem here is probably that the
script can not receive page size information from out of domain pages.
The resize works for pages hosted on my domain, but fails to resize
correctly for google and cnn. Some more hunting.
(On the other hand - if you can tweak the files you're calling in order
to tell the script their size - you're halfway there.)

Yep that's point 3 of my feature list ;-). I agree to you, if it works
so far, there must be a way to solve this problem, also. But how? I'm
unfortunately not good at javascript, at all.

@ Keven Darling:
You guessed right: the goal is, to adjust the Iframe to the height of
the contained website, in order to prevent scrollbars, in order to make
it look like the mainpage.

And we're still searching for the script that fulfills all our dreams
;-)
 
F

fran.carstens

Here's what I've found:

iFrames can contain pages from other domains, but server security
settings will not allow scripting cross domain. In other words - you
will not be able to use a script to determine the size of the pages
you're loading into your iFrame.

Source:http://support.microsoft.com/kb/q278469/

There is a possible solution, but requires php implementation:

Source: http://www.daniweb.com/techtalkforums/post199610-12.html

"I wrote a PHP proxy script that has some applications relevant to this
thread, so thought I'd update the thread with this....

If your webserver supports PHP, I have a script that is a solution to
the cross-domain security issues when doing things such as AJAX
requests, etc. Instead of directly requesting the content, request my
proxy.php passing in the real URL that you want. The proxy.php script
will go fetch the content for you and forward back that response to
your client script. It echoes back the full headers and response body.

proxy.php
http://www.troywolf.com/articles/php...ttp/proxy.phps

One problem people run into when using a proxy to get content is that
relevant URLs in links break. You can solve this by parsing the body
text, look for links, and if the link does not start with 'http://',
insert the original site url. It's not exactly a simple thing to do,
but a solution I've built in the past."

I'm going to try and implement this as soon as I have the time. I hope
it helps.

Francois.
 
T

TC

iFrames can contain pages from other domains, but server security
settings will not allow scripting cross domain.

It's nothing to do with the server. It's implemented by the browser.
There's nothing to stop a browser allowing cross-frame scripting,
should it wish to do so. Indeed, IE has a setting for this - not that
you'd want to actually -use- that setting.

HTH,
TC (MVP MSAccess)
http://tc2.atspace.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top