react-srcdoc-iframe

1.0.3 • Public • Published

React-srcDoc-iframe

Build Status

This is the polyfill of iframe srcDoc for react and supported upto IE-6.

  • Simple and light weight(<4KB).
  • Used both for src and srcDoc.
  • Easy to use.

Installation

Install the dependencies.

$ npm i react-srcdoc-iframe

Example

import React from 'react';
import ReactSrcDocIframe from 'react-srcdoc-iframe';

const html = `
  <!DOCTYPE html>
  <html>
    <head>
      <title>Hello Page</title>
    </head>
    <body>
        <p>Hello this is string html</p>
    </body>
  </html>
`;

const App = () => {
  return <ReactSrcDocIframe srcDoc={html} width="500" height="500" />;
};

Props

Plugin README
src string (url to render inside html)
srcDoc string (html string to render inside iframe)
id string (unique id for iframe)
style object ( {{border:"10px"}} )
onLoad funtion (after load iframe this will be called)
title string ("title for iframe")
frameBorder string ("0")
height string ("200px")
width string ("100px")
referrerPolicy string
sandbox string

License

MIT

Free Software, Hell Yeah!

Package Sidebar

Install

npm i react-srcdoc-iframe

Weekly Downloads

582

Version

1.0.3

License

ISC

Unpacked Size

5.91 kB

Total Files

4

Last publish

Collaborators

  • pldhiman