Related Tags:
JavaScript Javascript is an object-oriented computer programming language commonly used to create interactive effects within web browsers. Learn More, HTML Hypertext Markup Language, a standardized system for tagging text files to achieve font, colour, graphic, and hyperlink effects on World Wide Web pages. Learn More, IE (Internet Explorer) Microsoft Internet Explorer (abbreviated IE or MSIE) is a free web browser application produced by Microsoft in 1995. Internet Explorer was designed in response to the first geographical browser, Netscape Navigator. Learn More, Google Chrome Google Chrome browser is an open source program for accessing the World Wide Web and running Web-based applications. ... Google released Chrome in 2008 and issues several updates a year. It is available for Windows, Mac OS X, Linux, Android and iOS operating systems. Learn More,

window.onload() is not firing in IE while same code working fine in chrome

Description:I was trying to register click event onload and it is working fine in chrome but the event not firing at all in IE even in the latest version of IE.
I have tried following code


<script type="text/javascript">
window.onload = function(){console.log('event fired');}
</script>

Posted by: | Posted on: Dec 17, 2018

1 answers

Replies

4

Hi,
I have also faced same issue and solved it by just adding the new keyword before the function and it did the trick for me. Try using the following code instead of yours.

<script type="text/javascript">
window.onload = new function(){console.log('event fired');};
</script>

Replied by: | Replied on: Dec 17, 2018



Reply
×

Code block Hyperlink bold Quotes block Upload Images

Preview