cancel
Showing results for 
Search instead for 
Did you mean: 

Resize IFrame

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

former_member182372
Active Contributor
0 Kudos

Hi Jonathan,

So, as I can ubderstand you are trying to load formated text to IFrame. In this case you can analyze length of your text and may be analyze html tags which change text size.

best rehards, Maksim Rashchynski.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Cindy

I also need this same feature.

Can you please give me javascript on my mail address.

mjprajapati@gmail.com

Thanks in advance.

Mehul

Former Member
0 Kudos

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

http://www.sam-solutions.net

Former Member
0 Kudos

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.

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks Maksim,

I'm unsure how to obtain the content size. Could you show me the code needed to obtain it?

former_member182372
Active Contributor
0 Kudos

Hi Jonathan,

But it depends on what is placed in IFrame. There is no common rules for calculation.

Is it your custom application in IFrame?

best rehards, Maksim Rashchynski.

former_member182372
Active Contributor
0 Kudos

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.