on 06-16-2006 3:48 PM
Hi,
I'm am using an iFrame in Web Dynpro to display a string of formatted text. I would like to have the iFrame resize based on the content of the page loading so the iFrame does not load with a scroll bar. Does anyone know if this is possible? If it is possible can you show me how.
Thanks
The iFrame's source is a page generated by passing IWDCachedWebResource a string of formatted text. I pass the URL of the generated page to be displayed in the iView
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I needed this same feature and ended up doing quite a bit of research (and some trial and error) until I finally ran across the secret.
Leave the height and width properties of the iFrame blank. There is a javascript function that WD has that will adapt the size of the iFrame to the size of the body of the document within the iFrame (runs in the onload event of the iFrame).
We are currently using NW04s SP4, so earlier versions may or may not have this feature.
If this does not work for you, I have a work around solution, but it will only work if you can adjust the html of the iFrame contents (javascript would need to be added). If you need this, just respond to this post with an email address and I'll send it to you.
-Cindy
Cindy,
<i><b>There is a javascript function</b> that WD has that will adapt the size of the iFrame to the size of the body of the document within the iFrame (runs in the onload event of the iFrame).</i>
Really a secret weapon
<i> I have a work around solution, but it will only work if you can adjust the html of the iFrame contents (<b>javascript would need to be added</b>).</i>
Copy of first one? ))
Excuse me, just can not resist
I've tried to do the same without refering WD generated IDs, and I give up trying to find out how to link contentWindow and DOM node.
Please send me this function via e-mail, if possible.
VS
Mehul,
After short e-mail conversation with Cindy I've posted her solution (sure, refactored a bit) to my blog. Please read /people/valery.silaev/blog/2006/07/14/escaping-the-procrustean-bed
Valery Silaev
SaM Solutions
Hi Cindy,Valery
I tried both the methods in the blog by valery.They are not working for me .The first method throws a access denied java script error .As I am new to javascript I could not understand.The second method simply does not work.I use IE.Is there any property I need to set on Iframe UI element .Can u ppl please tell me what the problem could be and solution if possible.This is very urgent.Thanks a lot.
Thanks Maksim,
I'm unsure how to obtain the content size. Could you show me the code needed to obtain it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jonathan,
Create 2 context attributes iFrameWidth and iFrameHeight. Bind iFrame properties width and height to context attributes. In your code calculate values of context attributes depending of the content size.
best rehards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.