1.0.3 • Published 2 years ago

react-srcdoc-iframe v1.0.3

Weekly downloads
55
License
ISC
Repository
-
Last release
2 years ago

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

PluginREADME
srcstring (url to render inside html)
srcDocstring (html string to render inside iframe)
idstring (unique id for iframe)
styleobject ( {{border:"10px"}} )
onLoadfuntion (after load iframe this will be called)
titlestring ("title for iframe")
frameBorderstring ("0")
heightstring ("200px")
widthstring ("100px")
referrerPolicystring
sandboxstring

License

MIT

Free Software, Hell Yeah!