I'm currently using the postMessage function to set the width of my app part which is working however I've got a few issues with height.

The height is set using


which would be fine except this value is generated before the app part is resized, therefore the height returned is whatever it would be at 300px (give or take) wide, rather than the full width of the page. This results in the app part being about twice as high as it needs to be.

Is there anyway around this? I have seen the following style recommended

iframe {
    width: 100%;

however this doesn't seem to have any effect.

Are there any solutions to this? Thanks.

1 Answer 1


While you do not know how high the content will be after setting the width you will need two calls.

By the way: the CSS you provided where do you put it in? the AppWeb oder the host Web? it should go to the host web because there the styling takes place. another waay is to use a greater default width value. instead of 300 so that the margin will not be to big, but with this if the iFrame is getting smaller you will get scrollbars. So again two calls to be absolute sure.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.