admin管理员组文章数量:1402433
I have a website that works fine on Chrome and FF, but fails on Edge. When I look at the Console log (on Edge) it tells me certain javascript functions are undefined, if I switch the default Edge developer tool's debugger on I can see that one of my js files hasn't been loaded, but others have (See below). Console Log on FF and chrome report no errors or warnings. The page header is set to <!DOCTYPE html>
and the js is included like this...
<script src="js/generalUtils.js" type="text/javascript"></script>
<script src="js/dlmUtils.js" type="text/javascript"></script>
<script src="js/md5.js" type="text/javascript"></script>
generalUtils.js and login.js load, but dlmUtils.js does not get loaded. (nb There are also a bunch of 'remote' js loaded from ajax.googleapis successfully.)
The javascript in dlmUtils.js runs fine in Chrome and FF and does not report any errors or warnings on the console.
Thoughts?
jonb
I have a website that works fine on Chrome and FF, but fails on Edge. When I look at the Console log (on Edge) it tells me certain javascript functions are undefined, if I switch the default Edge developer tool's debugger on I can see that one of my js files hasn't been loaded, but others have (See below). Console Log on FF and chrome report no errors or warnings. The page header is set to <!DOCTYPE html>
and the js is included like this...
<script src="js/generalUtils.js" type="text/javascript"></script>
<script src="js/dlmUtils.js" type="text/javascript"></script>
<script src="js/md5.js" type="text/javascript"></script>
generalUtils.js and login.js load, but dlmUtils.js does not get loaded. (nb There are also a bunch of 'remote' js loaded from ajax.googleapis. successfully.)
The javascript in dlmUtils.js runs fine in Chrome and FF and does not report any errors or warnings on the console.
Thoughts?
jonb
Share Improve this question asked Aug 4, 2016 at 17:19 GreybeardTheUnreadyGreybeardTheUnready 2651 gold badge5 silver badges16 bronze badges 6- What do you see in the network tab? – SLaks Commented Aug 4, 2016 at 17:21
- Good point... Unfortunately no clue there. It reports dlmUtils exactly the same as all other local scripts that work, i this case loaded in 46.74ms – GreybeardTheUnready Commented Aug 4, 2016 at 17:41
- If you look in the source code of the page is your link to the file dlmUtils.js correct ? Can you open it ? – jeremy-denis Commented Aug 4, 2016 at 17:51
-
This is bizarre, The
<script src='js\dlmUtils.js'
shows up in the debugger window and does open, but in 'file explorer' type window to the left lists all scripts except dlmUtils.js !!!! – GreybeardTheUnready Commented Aug 4, 2016 at 17:56 - UPDATE: I think I'm on the track - chopping out all the content of dlmUtils.js the problem goes away. Adding the content back in a bit at a time it seems to be related to one (fairly large) function - I will report back when I've pinpointed the actual culprit. – GreybeardTheUnready Commented Aug 4, 2016 at 18:20
2 Answers
Reset to default 4Bizarre - I discovered that in fact the script was being loaded, but then quickly dumped. It turns out that Edge doesn't like defaulting parameters in Javascript. - I guess I missed a standards memo somewhere :-)
function showJobsheet(id=0) {
caused Edge to dump the script, so now...
function showJobsheet(id) {
id = ((typeof id !== 'undefined') ? id : 0);
This is the only change I've had to make and now everything works fine.
Thanks to all who offered help...
I was having this same problem. I was able to pin it down as Edge "dumping" the JS file as GreybeardTheUnready said by having the Edge dev tools open and showing the directory where the JS file should be. When refreshing the page, it does show in that directory momentarily, and then disappears.
Even with the experimental JavaScript features enabled, this was happening because I was using JavaScript's optional chaining (?.
). Removed those question marks and the JS file now sticks around. Unfortunately it means I have to make my code more verbose...
本文标签: htmlEdge not loading some javascriptStack Overflow
版权声明:本文标题:html - Edge not loading some javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744266460a2597970.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论