I am trying to run a piece of JavaScript to work with Microsoft Edge, but it does not start when the JavaScript code is stored in an external .js file. Errors are not returned, and all I can easily get from the debugger is that the function does not exist. The code works fine in IE 11, Chrome 45, and Firefox 39. The JavaScript built into the HTML page always works fine.
Can someone give me guidance on what I'm doing wrong?
The HTML file is called hjt01.htm and the external JavaScript is hjt01.js (in the same directory as
function externalbox()
{
alert("Clicked!")
}
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Description of page">
<meta http-equiv="pragma" content="no-cache">
<title>Webpage Title</title>
<meta name="description" content="Description of page">
<script language="javascript" type="text/javascript" src="hjt01.js"></script>
<script language="javascript" type="text/javascript">
function internalbox()
{
alert("Clicked!")
}
</script>
</head>
<body id="pagedetail">
<a href="javascript:externalbox();">External</a>
<br />
<br />
<a href="javascript:internalbox();">Internal</a>
</body>
</html>
Run codeHide result, . " JavaScript" "" Edge F12 Developers Tools, .
20.10240.16384.0 Edge.