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

@1milligram/frame

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@1milligram/frame

An iframe wrapper that resizes based on its content automatically

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Frame

A React component that wraps an iframe inside an element:

  • The iframe is only loaded when it is visible in the screen
  • The iframe is resized automatically when its content resizes

Due to the cross domain (CORS) issue, it only supports iframe whose src belongs to the same domain of your site.

Usage

  1. Install the package:
$ npm install @1milligram/frame
  1. Using the Frame component:
import { Frame } from '@1milligram/frame';
import '@1milligram/frame/lib/styles/index.css';

<Frame url="/path/to/iframe" />;

Options

Setting the frame height

For any reason that you would like to do your own calculation to adjust the frame height:

const setFrameHeight = (doc: Document) => {
    // `doc` is the document instance of the iframe content
    return doc.body.scrollHeight;
};

<Frame setFrameHeight={setFrameHeight} />;

Keywords

FAQs

Package last updated on 28 Sep 2021

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