react-srcdoc-iframe

String HTML parse into iframe and supported IE6.This is polyfill of srcDoc.

Usage no npm install needed!

<script type="module">
  import reactSrcdocIframe from 'https://cdn.skypack.dev/react-srcdoc-iframe';
</script>

README

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!