This can take all types of html scripts!
First, clone the repo: git clone https://github.com/powerbox1000/embedderjs
.
Then, just include this script in your web page using
<script src="path/to/script/embedder.js></script>
Then, insert a <div id="my-id"></div>
where you want the embedd, replacing "my-id" with your id.
Finally, insert this script before the </body>
tag:
<script>
EmbedderJS.embedHTML("my-id","<html></html>",true, 500, 500);
</script>
and you, of course, replace my-id with your id and <html></html>
with the full html. Replace the number 500 with the correct width and height in the order: width, height.
Input | Type | What it does |
---|---|---|
id | string | the id of the element you want to embed the HTML in. |
html | string | The HTML to embed |
contains <html> tags? |
boolean | Set to true if your HTML has <html> tags |
width (optional) | string or integer | width of embed (only if contains html tags? is true) |
height (optional) | string or integer | height of embed (only if contains html tag is true) |
If the contains html tags
input is set to true, it will generate a data:
URI and embedd it using iframe.
Just add:
<script>
EmbedderJS.embedHTML("my-class","<html></html>", 500, 500);
</script>
and you, of course, replace my-class with your class and <html></html>
with the full html. Replace the number 500 with the correct width and height in the order: width, height.
Input | Type | What it does |
---|---|---|
class | string | the class of the element(s) you want to embed the HTML in. |
html | string | The HTML to embed |
width | string or integer | width of embed |
height | string or integer | height of embed |
- Add the style of the iframe
Just put ideas and bugs in the "Issues" section!
copyright©2020 DevTime Scripting, Inc.