0

I can’t get my external JavaScript to run.

My index.html is:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Test</title>
</head>
<body>
  <h1>Test</h1>
  <script> console.log("foo") </script>

  <!-- NOT WORKING-->
  <script src="scripts/notworking.js" type="javascript"></script>

  <script> console.log("bar") </script>
</body>
</html>

my notworking.js contains only the following two lines:

console.log("working?")
alert("working!");

But nothing happens. Only the "foo" and "bar" from the index.html file are displayed.

2
  • Did you get any error on loading notworking.js to the index.html Commented Sep 15, 2016 at 12:19
  • no, i dont get an error. If i add a file that not exists for example notworkingAAA.js then i get an 404 Commented Sep 15, 2016 at 12:24

1 Answer 1

1
<!-- NOT WORKING-->
<script src="scripts/notworking.js" type="javascript"></script>

type="javascript" is no valid MIME type.

Use type="text/javascript" or simply remove it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.