How Can I Run JavaScript Without DOM Access?

0
0
Asked By CreativeCoder82 On

I'm building a website similar to CodePen, focused exclusively on JavaScript, but I'm planning to create my own APIs. The key thing is that I want the code execution environment to be free from any browser-dependent features like the DOM or fetch. It's somewhat like Scratch but for JavaScript. I'm struggling with the implementation of running JavaScript in this setup. Any suggestions on how to achieve this?

4 Answers

Answered By WebDevNinja99 On

Consider using the `sandbox` attribute on the iframe. It could be exactly what you need to limit access and run JavaScript safely!

Answered By CodeGuru47 On

You might want to look into a WebAssembly-JS engine like QuickJS. Some web tools use similar methods to implement plugins securely and could fit your needs perfectly.

Answered By TechieWhiz34 On

Have you thought about using a web worker? You can specify exactly what features you want to expose to it. Alternatively, wrapping your JavaScript execution in an iframe could work too!

Answered By SnarkyReplyer88 On

Maybe you should try searching 'javascript interpreter in javascript' before posting. There's actually quite a few projects out there that might be what you're looking for.

HelpfulPal77 -

Hey, no need to be rude! The guy's just asking for help here. That's what forums are for, right?

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.