html - <iframe> - How to show the whole height of referenced page? -
i have application embed inside our companies cms. way (i told), load in <iframe>
.
easy: set height
, width
100%
! except, doesn't work.
i did find out setting frameborder
0
, @ least looks part of site, i'd prefer not have ugly scrollbar inside page allready has one.
do know of tricks this?
edit: think need clarify question somewhat:
- the company cms displays fluff , stuff our whole website
- most pages created through cms
- my application isn't, let me embedd in
<iframe>
- i have no control on
iframe
, solution must work referenced page (accordingsrc
attribute ofiframe
tag) - the cms displays footer, setting height 1 million pixels not idea
can access parent pages dom referenced page? might help, can see people might not want possible...
this technique seems work (gleaned several sources, inspired link accepted answer:
in parent document:
<iframe id="myiframe" name="myiframe" src="http://localhost/child.html" scrolling="auto" width="100%" frameborder="0"> no iframes supported... </iframe>
in child:
<!-- ... --> <body> <script type="text/javascript"> function resizeiframe() { var docheight; if (typeof document.height != 'undefined') { docheight = document.height; } else if (document.compatmode && document.compatmode != 'backcompat') { docheight = document.documentelement.scrollheight; } else if (document.body && typeof document.body.scrollheight != 'undefined') { docheight = document.body.scrollheight; } // magic number: suppress generation of scrollbars... docheight += 20; parent.document.getelementbyid('myiframe').style.height = docheight + "px"; } parent.document.getelementbyid('myiframe').onload = resizeiframe; parent.window.onresize = resizeiframe; </script> </body>
btw: work if parent , child in same domain due restriction in javascript security reasons...
you either use scripting language include page parent page, other wise, might want try 1 of these javascript methods:
http://brondsema.net/blog/index.php/2007/06/06/100_height_iframe http://www.experts-exchange.com/web_development/web_languages-standards/php/q_22840093.html
Comments
Post a Comment