Mihai Hangiu
Mihai Hangiu

Reputation: 598

Microsoft Edge Refresh button does not execute the onLoad java script code

I have the following simple java script code which does not execute when I press the Refresh button in Microsoft Edge. None of the 3 alerts execute at refresh. It works well with Chrome.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
  <script type="text/javascript">
  jQuery(function() {
    alert('jQuery');
  });
  function func() {
    alert('func');
  }
  function load() {
    alert('load');
  }
  window.onload = load();
  func();
  </script>
</head>
<body>
</body>
</html>

This code can be put in an HTML file (test.html).

Why does this happen? Thank you.

Upvotes: 1

Views: 809

Answers (1)

hellol11
hellol11

Reputation: 428

Maybe use window.addEventListener("load", load, false);. Sometimes, if one thing doesn't work, another will.

Upvotes: 1

Related Questions