AspBucket offers ASP.NET, C#, VB, Jquery, CSS, Ajax, SQL tutorials. It is the best place for programmers to learn

Thursday 11 August 2016

How to resize iframe to fit content cross domain?

If we are called cross domain url in frame we will get problem to get iframe height due to permission issue. We can use an external javascript library to get-up to fix this issue we can download it from here.

Let's say we want to call an iframe page from another domain(

So I will add iframe html on my page like below
<iframe src="" scrolling="no"></iframe>

Please follow below to configure it

Step 1- Add reference of java-script file iframeResizer.contentWindow.js inside iframe page

Step 2-Add reference of javascript file iframeResizer.js inside your html page like.
<iframe src="" width="100%" scrolling="no"></iframe>

<script type="text/javascript" src="iframeResizer.js"></script> 
<script type="text/javascript">

That's it. you can test your iframe page. There are many more options available for iframe-resizer, refer to the developer site. This example shows a minimum setup.


Post a Comment

  • Popular Posts
  • Comments