react-use-iframe-content-height

A React hook to poll an iframe for it's content height. It will only work if the parent and the source of the iframe are on the same domain.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
react-use-iframe-content-height
001.0.24 years ago4 years agoMinified + gzip package size for react-use-iframe-content-height in KB

Readme

react-use-iframe-content-height
A React hook to poll an iframe for it's content height. It will only work if the parent and the source of the iframe are on the same domain.

Usage:

function MyIframe() {
  const [iframeRef, iframeHeight] = useIframeContentHeight();

  return (
    <iframe ref={iframeRef} height={iframeHeight} width="100%" src="/content" />
  );
}