Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

iframe-resizer

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iframe-resizer

This project has now been split into two separate packages. Please use '@iframe-resizer/parent' and '@iframe-resizer/child'. See https://iframe-resizer.com/upgrade for more details.

  • 5.2.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
407K
decreased by-1.63%
Maintainers
1
Weekly downloads
 
Created

What is iframe-resizer?

The iframe-resizer npm package provides a set of tools to automatically resize iframes to fit their content and to enable communication between the iframe and the parent page. It is useful for ensuring that iframes are displayed correctly without scrollbars and for passing data between the iframe and the parent page.

What are iframe-resizer's main functionalities?

Automatic Resizing

This feature automatically resizes the iframe to fit its content. The `log: true` option enables logging for debugging purposes, and `#myIframe` is the selector for the iframe element.

const iFrameResize = require('iframe-resizer/js/iframeResizer');
iFrameResize({ log: true }, '#myIframe');

Height Calculation Methods

This feature allows you to specify different methods for calculating the height of the iframe. The `heightCalculationMethod` option can be set to various values like 'bodyScroll', 'documentElementScroll', 'max', etc. In this example, 'taggedElement' is used.

iFrameResize({ heightCalculationMethod: 'taggedElement' }, '#myIframe');

Message Passing

This feature enables sending messages from the parent page to the iframe. The `sendMessage` method is used to send a message to the iframe.

const iframe = iFrameResize({ log: true }, '#myIframe')[0];
iframe.iFrameResizer.sendMessage('Hello from parent');

Event Handling

This feature allows you to handle events such as resizing. The `resizedCallback` option is a function that gets called whenever the iframe is resized.

iFrameResize({
  resizedCallback: function(messageData) {
    console.log('Iframe resized:', messageData);
  }
}, '#myIframe');

Other packages similar to iframe-resizer

Keywords

FAQs

Package last updated on 22 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc