Newsletter

Subscribe now and benefit!

Resizable iFrame function

To activate this function on your side, there is only one small detail which needs to be changed in your iframe code:

  • A JavaScript data file has to be implemented before the iframe.
  • The attributes id and name of the iframe need to be identical and have to begin with resizeIframe.

After that you can determine the actual width of the iframe (attribute: width) to fit your design.

The new code for the iframe is as follows:

For an asynchronous request on the JavaScript the following demand may be used:

If you are using a single page application (SPA), the "load" event is not fired when a "virtual" page change occurs and therefore our resize function is not executed.

With the help of the following instructions, you have the possibility to determine the moment of the resize function yourself, so that you are not dependent on the "load" event:

Integrate this code block when using an SPA:

Once the script and iFrame are loaded/rendered, the following function can be executed to trigger the Resizeable iFrame functionality:

The execution of the Resizeable iFrame functionality can be stopped with the following function if required: