Having a problem with iframe resizing when the iframe body is a jsp file which contains a dynamically built ajax table. Users select different options from a drop down. All but 1 is a standard static jsp file. The other is a jsp file with a dynamic ajax table which is generated the second the user select this option from the drop down. Problem is the javascript is not getting the correct height for the dynamically ajaxed jsp file.
Here is the iframe which is loading the contents file. <iframe id="Editor" name="Editor" src="" scrolling="no" frameborder="0" allowtransparency="true" onLoad="resizeIframeToFitContent(this)"></iframe> Resize call: function resizeIframeToFitContent(iframe) { iframe.height = Editor.document.body.scrollHeight + 300; iframe.width = Editor.document.body.scrollWidth; } // resizeIframeToFitContent
As a current workaround I am adding 300 manually to the height this works but throws the height of the normal jsp files well out and makes the page to tall.
I'd like to resize an iframe into which different (same domain) pages of differing heights are loaded. I can do a first-time resize no problem. It's the subsequent reloads that need to pass back their height to the parent page There seem to be lots of solutions for that around, but few I can see for resizing each time the iframe reloads. One is described here on another board [URL] but unfortunately the test page is no longer around (or indeed the site), so the full code is no longer available there. This one works, almost, for me: [URL] it does resize for me, but not quite sufficiently high each time - about 90% of what is required: [URL] Is there a way to add on sufficient extra margin that scrollbars no longer appear?
the code above gets called every time a new page is loaded inside the iframe (ifrmDisplay) what its doing is resizing the iframe so it can have the same size as the page inside it, so i can eliminate the need for vertical scroller for the iframe, i assumed that it works on opera and IE at the same time, when i tried it out, it worked on IE but not on opera. after lot of time in researching how i can get workaround this issue with opera, that is the best possible solution i have and yet it doesnt work. so i gave up and asking you if you can help me out here , coz this is jst driving me crazy!
the problem is im not a javascript expert, to be honest i jst started doing javascripts about two days ago, that is why im in need for help
by the way, here is inner html for the iframe if its any use
the code above gets called every time a new page is loaded inside the iframe (ifrmDisplay) what its doing is resizing the iframe so it can have the same size as the page inside it, so i can eliminate the need for vertical scroller for the iframe, i assumed that it works on opera and IE at the same time, when i tried it out, it worked on IE but not on opera. after lot of time in researching how i can get workaround this issue with opera, that is the best possible solution i have and yet it doesnt work. so i gave up and asking you if you can help me out here , coz this is jst driving me crazy!
the problem is im not a javascript expert, to be honest i jst started doing javascripts about two days ago, that is why im in need for help
by the way, here is inner html for the iframe if its any use
i am trying to resize an iframe which is not in same domain.I tried couple of ways as below: iam loading an html which is in other domain.I kept this syntax in script
function toBeCalledOnChildHTMLLoad() { parent.document.getElementById("ifameId").height = calculatedHeight; }
Still it is not working..Please suggest if u have any solutions on this.
Its my first in this community and I hope someone can help me on this one. I�m currently working on the personalization of the layout of SAP ERP Portal. This Portal Framework uses Iframes to display the current page and/or applications on the Current Page.Here is a custom draw of a page
---- Custom Componentes Like Menus etc
----- Iframe (InnerPage) � Shows the Current Page
--------This Page can have embedded content and/or More Iframes with Applications
All the Iframes are on the same domain but I only have acess to the innerPage Code and not to the iframes that have the applications.Now we want the innerpage to automatic resize to the current content. This is being a problem (even after using jQuery Plugins or Resize Scripts) because:
1)The Iframes that have the applications change content height using Ajax/DHTML (not triggering load event) and this resize scripts wont call the resize mechanism.
2)I don�t have access to the applications source
3)On some tests ive made using Scripts ( for example Auto Height Jquery, SSI Dynamic Drive )some iframes display the same clientHeight and ScrollHeight Even if theres a scrollbar in the browser window.
I'm looking for the way to resize an element when the page loading. I'm doing some test and I've try :
function placeHeader () { var x; document.getElementById('header').style.display = 'visible' for (x = 0; x < 150;x++) { document.getElementById('header').style.width = x + "px"; }}
I have a mysql database with a bunch of quotations in it. I created a blog at http:[url]....At the top of the blog is an iframe window that directs to http:[url]....On that page it uses php to pull out a random quote from the database. The iframe window displays that quote onto the blog.It works great except that the height is not automatically resizing.Is there a way I can use javascript to do this instead? Here is some pseudo-code of what I'd like to be able to do: (p.s. I do not know javascript or much of anything so I am looking for people to tell me how to ACTUALLY do this)
var stringvariable = http://aro2220.com/blog/index.html;
Does anyone know of how I could dynamically resize an iframe based on the content's height (for IE) so that no scrollbar appears for the iframe? The content will be from a different domain. I have searched on the web and have seen solution like this
<script> function resize() { var oframe = document.getElementById("frameID");
The html : <iframe onload="resize()" src=http://different.comain.content border="0" ....... > </iframe>
I have seen 2 solutions on the web, the only difference being lines (1) and (2) get substitued. My browser is version IE 6.
It seems that the solution with line (2) works perfectly when the content is from the same domain but gets a Permission Error if the domain is different.
When the content is from a different domain solution (1) does not give Permission error, but instead the scrollHeight is significantly smaller than the actual content. Even if the content is from the same domain it still gives the wrong size.
So my question is 1) What is the difference between oframe.document and oframe.Document, why does it give different results?
2) More importantly, how can I dynamically adjust the iframe size based on the content height from a different domain?
The content is coming from an Ajax request. The content gets used more than once on the page for other purposes which is why I don't simply change the iframe src--I have to do an ajax request regardless so I'm trying to avoid multiple calls.
After I load the content, I need modify the height of the iframe so it fits snuggly around the content.
Calculating the height isn't a problem with the exception that it's not always correct and I think it's because the calculation is happening before images have downloaded.
I don't seem to be able to rely on a `load` or `ready` event to delay the calculation. The load event is the only one that tiggers on a change of iframe content, but it doesn't see the new content.
Is there any way to resize an iframe dynamically to the height of its content that works cross browser and works when the iframe content is on another domain than the main page (I have access to both pages, so code can be put in either) Also, it must resize when links in the iframe are clicked (ie when a new page within the iframe is loaded)
I found a javascript code online which automatically resizes an IFRAME based on the content loaded into it.
[Code]...
As you can see, the IFRAME I am resizing automatically is called "star_content" - This frame exists on a page with a set of links below it, which determine what content is to be loaded into it. The content being loaded into it is Daily, Monthly and Yearly horoscopes. The longest being the Yearly one. Now when I click the yearly one, the iframe extends as expected... but if I go from the yearly one back to the Daily or Monthly one, it doesn't shrink again so I end up with a huge gap. I can't show you the page itself because it's a closed site, still in development and I am under a non disclosure contract. However, here is the IFRAME HTML.
[Code]....
So to sumarise, what I want to do is have the iframe automatically resize to fit the content that has been loaded within it. It's doing that when it needs to extend the height of the frame but it's not then reducing the height when it goes back to something smaller.
How would i change iframe content from another? ? I just need the 1 line code not a whole example, what i have atm is the page refreshes and a new variable is given i want the variable displayed on another iframe.
I am a little confused about this and whether this is an appropriate approach. I have put this together so far. What it does is display a different html page into the IFrame if the person clicks the link. However, this is not what I want to do. What I want to do, is if Windows XP is detected to display load1.html into the Iframe and if Windows Vista is detected to display load2.html into the iframe.
I have a situation where I'd like to read/parse the content of a file I've read into an <IFRAME>. I've looked through various FAQs and searched forums, and the closest I get to accessing the file content is
myIframe.contentWindow.document.body.innerHTML
where myIframe is the node from getElementById(). But while I can see the content of the file on my web page, I get an empty string from the above reference. How do I get to the file?
I am trying to get at the content of an iframe but it seems that the content is loading after the alert is fired: index.php: <!doctype html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>iFrame test</title> <script src="[URL]"></script> <script type="text/javascript"> $(function() { $('<iframe src="[URL]" id="the_iframe" name="upload_iframe" />').load(function(){ var txt = $('#the_iframe').contents().find('#inside_iframe').text(); alert(txt); }).appendTo('body'); }); </script></head><body> </body></html>
In test.php I just have: <div id="inside_frame">this is some text</div> I don't get any errors in the console and the alert() just returns an empty string. I've also tried just placing the iframe directly in the html and that gets the same result too.
var moreinfo =""; moreinfo+= "here some content"; $("#divMoreInfo").html(moreinfo);
And this inserts "here some content" in a div called divMoreInfo.
Now divMoreInfo is placed inside an iframe while the rest of the programming has to be in the parent page... How do I insert moreinfo's contents in the iframe's div?
I've been able to get the iFrame to resize to the content - see this link - it's pretty simple. My only problem, is if the user clicks a link so that another page is displayed, the iFrame doesn't resize. It will only resize when the parent page is reloaded. So, not sure what to do about that.
(I do work with someone who writes Javascript and PHP, so they would know how to implement it if I found a solution).
i got a page with menus on top and an iframe in the middle of this page. Now what i want to know is how can i change iframe's content when i click on the menu's hyperlinks. Like when i click the "About" in the menu i want to see about.html in iframe.
I have a page where I load in a template from another company via IFRAME, the template I cannot change, but on a certain page of the template within the iframe I would like to tell the user some extra information, but my page remains the same and only the information in the iframe reloads, so is there a way to tell when the iframe changes so i can innerHtml some extra info on certain parts?
I'M working on a web page. My main index got a fix menu bar (title bar + menu (buttons with over effects, etc).
I used table to place my content so it would have one big banner with buttons and two iframes that would show two different content.
I worked so far that my main index render the frame with their respective backgrounds all detailled in css, fonts, align etc etc.
Is it possible to create blocks of information, all with the same CSS and then, just making the buttons tell the iframe which content to show ? The back ground will never change, just the content. IS it possible ?