Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can I run JavaScript in the browser without HTML? Why/Why Not?

I’m new to web development and I’m wondering if it’s possible to run a JavaScript file in the browser without using HTML and a <script> tag, and without using a framework.

I’m only asking because in React (using create-react-app), the index.js file just runs in the browser without any HTML file loading it in. How is this possible?

Any links/articles/insight would be greatly appreciated.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

No, it isn’t possible — excluding the REPL terminal in the browser dev tools.

create-react-app does use HTML. The create-react-app server dynamically injects the script tag into the HTML thats in your project in public/index.html. You can see this if you use the browser dev tools to inspect the DOM.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading