Posted by matt_c on January 18, 2009 at 11:34am
| Project: | Iframe |
| Version: | 6.x-1.3 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
Is it possible for the IFRAME module to automatically detect the height of the target url and scale accordingly. This would mean the IFRAME always displays without a scroll bar.
And if not, can we have master settings for width and height? i.e. not exposed to the users in a cck field?
Comments
#1
1) it is possible to detect the height of the iframe, BUT only if the iframe-content is from the same domain (same-origin-policy by the browsers)
see:
get http://schuessler-reisen.de/sites/all/js/iframe_resize.js and adjust the iframeid Variable at top.
You have to include it in your master-Template page.tpl.php
2) You can give master width and height, when You add the iframe-cck-fields on your "content-types" (e.g. story, btw. page)
(if this is not working for You file a bug-report please)
n
#2
#3
Hi,
thats the answer that I was searching for.
But I have a small problem with it, because I'm not a great programmer.
What is the "iframeid" and where can I look it up?
How do I include the JavaScript into my page.tpl.php?
Can I use my theme page.tpl.php?
Sorry for this stupid questions, but like I said I'm totally new to tweaking Drupal files in this way.
Cheers Leiche
#4
Doh ... sorry for this post, but I forgot to reactivate the issue :(
#5
See insertframe module
#6
I rolled a patch which allows you to set an automatic height. Because resizing an iframe is only possible between the same domain, I also added an proxy PHP script that will serve your external pages through your own domain. All relative paths are kept by use of the base tag.
In short, this lets you set the height to 'auto'.
#7
Added functionality to proxy also URLs with paths, like example.com/page, and URLs with queries, like example.com?query=example. I also fixed the base tag injection so that it considers paths, for relative URLs.
#8
This is not working for me. I have this
I also tried with iframe id="iframe-0"
Finally, I tried height="100%"
any thoughts/ideas?
#9
Did you apply the patch successfully? Have you tried setting the height to 'auto' instead of '100%'?
Your problem could also be related to a bug in Iframe, #664838: Conflicting iframe IDs, if you are using more than one iframe per page.
#10
Realizing this wont work too well on cached iframes (cached CCK field, cached block, cached view, etc) I decided to put the javascript inclusion in hook_init() and made it work on all iframe tags with an 'auto' height. This also helped clean the code up some.
#11
From reading code:
- Why the use of curl and not drupal_http_request?
- Maybe instead 'auto' we can accept 0. I think it's better for a field to be of the same type (a number and not mixed).
#12
The function drupal_http_request() doesn´t support proxy. That is so bad.
Curl should support DNS cache.
#13
Hi,
can someone please explain step by step, how to do all this?
" You have to include it in your master-Template page.tpl.php" - where to include very top before "php", this cause top errors, body errors... head errors, or it is some part of the code.
"iframe_resize.js " - i have to create this file in my template master folder?
"You can give master width and height" -What this means, master? "100%" "auto"
A big part of us are only common mortals ;-)
Thank you for your time.
#14
The proxy script doesn't bootstrap Drupal, for performance reasons, and so it doesn't have access to drupal_http_access(). You do have a point though - that function, I believe, have a fallback for curl-less environments and so should this proxy.
It turns out IE doesn't support resizing like this, at all. I don't know why or if it can be made to work. One solution would be to put the "auto" metadata outside the height property and let the height value only control the initial height of the iframe. If the tag supports it, maybe rel="autoheight" would work?
#15
Subscribing.
#16
Hello
I have downloaded version 6x 1.3 of the module and aplyed the path to it, but it doesen't work for me. The iframe always gets the height of 700px.
The iframe is loaded from another domain.
Anyone has an idea?
grts
frederic
#17
please explain me more deatil how to adjust the frameid and how to include it in master template page.tpl.php...
sorry for dumb question...:D
#18
@tobiassjosten,
Did you apply your patch to the latest 6.x-1.8 version ?
For me it works for same domain content in iFrame, but i still can't make it work with the proxy script.