# davidjbradshaw/iframe-resizer

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/davidjbradshaw-iframe-resizer).**

6,927 stars · 974 forks · JavaScript · NOASSERTION

## Links

- GitHub: https://github.com/davidjbradshaw/iframe-resizer
- Homepage: https://iframe-resizer.com
- awesome-repositories: https://awesome-repositories.com/repository/davidjbradshaw-iframe-resizer.md

## Topics

`cross-domain` `cross-origin` `iframe` `iframed-page` `resize`

## Description

iframe-resizer is a JavaScript tool that automatically adjusts the dimensions of an iframe to match the size of its internal content. It functions as a cross-domain communication bridge, allowing the exchange of data and the triggering of actions between a parent window and an embedded iframe across different origins.

The project includes a nested iframe coordinator to synchronize dimensions between parent pages and inner frames, preventing scrollbars in complex nested structures. It also provides an accessibility utility to manage iframe titles and attributes, ensuring embedded content is compatible with screen readers.

The system covers a broad range of capabilities, including bidirectional JSON messaging, origin-based security filtering to restrict communication to trusted domains, and scroll synchronization for in-page anchor links. It further supports integration within component-based architectures through specialized wrappers for various frontend frameworks and jQuery.

## Tags

### User Interface & Experience

- [Auto-Resizing Iframes](https://awesome-repositories.com/f/user-interface-experience/navigation-routing/iframe/auto-resizing-iframes.md) — Automatically adjusts iframe dimensions to match internal content and prevent scrollbars.
- [Iframe Content Resizers](https://awesome-repositories.com/f/user-interface-experience/resizable-panes/element-resizers/resizing-constraints/iframe-content-resizers.md) — Automatically scales an iframe's dimensions to match the size of its internal content to prevent scrollbars. ([source](https://iframe-resizer.com/api/parent))
- [Dynamic Size Calculators](https://awesome-repositories.com/f/user-interface-experience/measurement-tools/dynamic-size-calculators.md) — Computes required iframe dimensions by analyzing the internal scroll height and width of the guest document.
- [Nested Iframe Resizing](https://awesome-repositories.com/f/user-interface-experience/navigation-routing/iframe/auto-resizing-iframes/nested-iframe-resizing.md) — Resizes nested frame structures by communicating dimensions between parent and inner frames to prevent scrollbars. ([source](https://iframe-resizer.com/guides/google_apps_script))
- [Minimum Dimension Calculators](https://awesome-repositories.com/f/user-interface-experience/resizable-panes/dimension-controllers/minimum-dimension-calculators.md) — Calculates the required iframe dimensions based on internal element properties to ensure a perfect content fit. ([source](https://iframe-resizer.com/api/child))
- [Iframe Accessibility Utilities](https://awesome-repositories.com/f/user-interface-experience/iframe-accessibility-utilities.md) — Manages iframe titles and attributes to ensure embedded content is compatible with screen readers.
- [Nested Coordination](https://awesome-repositories.com/f/user-interface-experience/navigation-routing/iframe/nested-coordination.md) — Manages size and scroll synchronization for complex structures where iframes are embedded within other iframes.
- [Screen Reader Accessibility](https://awesome-repositories.com/f/user-interface-experience/screen-reader-accessibility.md) — Improves screen reader support by dynamically managing iframe titles and accessibility attributes.
- [Nested Scroll Coordination](https://awesome-repositories.com/f/user-interface-experience/scroll-areas/scroll-orchestrators/nested-scroll-coordination.md) — Coordinates dimensions and scrolling between parent pages and inner frames to eliminate nested scrollbars.

### Networking & Communication

- [Iframe Messaging](https://awesome-repositories.com/f/networking-communication/communication-protocols-architectures/iframe-messaging.md) — Uses the browser postMessage API to exchange JSON data between parent windows and guest iframes.
- [Cross-Domain Coordination](https://awesome-repositories.com/f/networking-communication/cross-domain-data-streaming/cross-domain-coordination.md) — Coordinates resizing and communication between parent pages and iframes across different domains. ([source](https://cdn.jsdelivr.net/gh/davidjbradshaw/iframe-resizer@master/README.md))
- [Iframe Message Bridges](https://awesome-repositories.com/f/networking-communication/json-rpc-implementations/iframe-message-bridges.md) — Provides a bidirectional messaging interface for state synchronization between host and guest iframes.
- [Message Bridges](https://awesome-repositories.com/f/networking-communication/message-bridges.md) — Implements a messaging bridge to synchronize dimensions and exchange data between different domains.

### Security & Cryptography

- [Domain Access Restrictions](https://awesome-repositories.com/f/security-cryptography/domain-access-restrictions.md) — Implements origin-based security filtering to restrict cross-domain messaging to a whitelist of trusted domains. ([source](https://iframe-resizer.com/api/child))
- [Cross-Origin Security Policies](https://awesome-repositories.com/f/security-cryptography/cross-origin-security-policies.md) — Validates incoming message origins against a whitelist to prevent cross-site scripting attacks.
- [Recursive Resizing](https://awesome-repositories.com/f/security-cryptography/iframe-sandboxing/nested/recursive-resizing.md) — Communicates size updates through a chain of parent and child frames to resolve nested iframe dimensions.

### Web Development

- [Guest Script Architectures](https://awesome-repositories.com/f/web-development/guest-script-architectures.md) — Uses a guest script inside the iframe to calculate internal dimensions and report them to the parent window.
- [Framework Integration Wrappers](https://awesome-repositories.com/f/web-development/framework-integration-wrappers.md) — Ships dedicated library wrappers that adapt iframe resizing functionality for various frontend frameworks. ([source](https://iframe-resizer.com/api))
- [Frontend Framework Integrations](https://awesome-repositories.com/f/web-development/frontend-framework-integrations.md) — Synchronizes iframe dimensions across various JavaScript libraries using specialized frontend framework integrations. ([source](https://iframe-resizer.com/frameworks))

### Software Engineering & Architecture

- [Event-Driven Callbacks](https://awesome-repositories.com/f/software-engineering-architecture/event-driven-callbacks.md) — Triggers customizable JavaScript functions on the parent page when resize or scroll events are detected.
