Answer the question
In order to leave comments, you need to log in
I'm trying to include babel for react in html. Writes File to load file:///D:/Programmes/Projects/Project1/scripts/script.js?
Writes File to load file:///D:/Programmes/Projects/Project1/scripts/script.js: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
What's the matter?
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Infinity</title>
<link rel="shortcut icon" href="images/CD.ico" type="html/x-icon" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script src="https://code.jquery.com/jquery-3.2.1.js"></script>
<script src="scripts/react.js"></script>
<script src="scripts/react-dom.js"></script>
<script src="scripts/browser.min.js"></script>
<script type="text/babel" src="scripts/script.js" defer></script>
</head>
<body>
<div id="example "></div>
</body>
</html>
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('example');
));
Answer the question
In order to leave comments, you need to log in
I think create-react-app or codesandbox would be your best bet for now .
The problem itself is that you are opening the document in the browser, and not getting it from the server.
Try to open the file not directly from the local machine, but raise a simple static server (SimpleHTTPServer, node-static)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question