stealth_angoid stealth_angoid - 1 year ago 131
HTML Question

Unable to run JavaScript in external file in Microsoft Edge browser

I'm trying to get a piece of JavaScript to run using Microsoft Edge, but it does not run when the JavaScript code is held in an external .js file. No errors are returned, and all I can readily get from the debugger is that the function does not exist. The code works perfectly well in IE 11, Chrome 45 and Firefox 39. The JavaScript embedded in the HTML page itself always works fine.

Can someone give me a steer as to what I am doing wrong?

The HTML file is called hjt01.htm and the external JavaScript is hjt01.js (in the same directory as

function externalbox()

<!-- saved from url=(0014)about:internet -->
<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()
<body id="pagedetail">
<a href="javascript:externalbox();">External</a>
<br />
<br />
<a href="javascript:internalbox();">Internal</a>

I've searched the Web but can't find any relevant information. I have tried setting the "Edit JavaScript" setting to Enabled in Edge's F12 Developers Tools, but this has made no difference.

I have version 20.10240.16384.0 of Edge.

Answer Source

I work on the Microsoft Edge team.

This definitely appears to be a regression in behavior from Internet Explorer, where this worked, and continues to work on Windows 10. I'll ensure that our team is aware of the issue and working towards resolution.

I'll update this answer when the issue has been resolved.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download