I'm new to jQuery.I have learned that DOM content will be loaded first and then window.onload event will occur as all the style sheets and images have to be loaded. But this doesn't turn out for me with the following code
<!DOCTYPE html>
<html>
<head>
<title>Add Event Listener</title>
<script type="text/javascript" src="../jquery-3.2.1.js"></script>
<script type="text/javascript" >
$(document).ready(function(){
alert("DOM Loaded");
});
$(window).on("load",function(){
alert("Window Loaded");
});</script>
</head>
<body>
</body>
</html>
After Opening this on Google Chrome (63.0.3239.108) I'm getting an alert that Window is Loaded prior to the alert of "DOM Loaded". Same problem with Microsoft Edge (40.15063.0.0)
But,this works fine with Firefox(57.0.3)
Can anyone explain this?
Thanks in advance ! This Question is not a duplicate of
window.onload seems to trigger before the DOM is loaded (JavaScript)