DEV Community

Cover image for Run HTML, JS, CSS with JS

Posted on

Run HTML, JS, CSS with JS

Q: How to run Run HTML, JS, CSS with JS?

Ans: BLOB!

Can Be Used As File eg: src="outputFileUrl"

Use Code:

var codeText = ``; // Some Code In HTML/JS/CSS

var outputFileUrl = URL.createObjectURL(new Blob([codeText], {

// Can Use Any File Type
type: "application/javascript" // - For JS, "text/html" For HTML, "text/css" for CSS


Enter fullscreen mode Exit fullscreen mode

Possible Uses: **
1) **Code Editor

2) Editing JS After Page Loads.
3) Many More!

See My Example: CodePan

Discussion (0)