Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For some reason, it appears that IE overrides the <code>onload</code> property of <code>window</code> with an empty object after the DOM is loaded. At least that is the case when you try to access it from within any event handler of a DOM element...</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Test by Josh&lt;/title&gt; &lt;script type="text/javascript"&gt; window.onload = function() { alert("Test"); } alert(typeof window.onload); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;h1 onclick="alert(typeof window.onload);"&gt;Test&lt;/h1&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>In this situation, you'll see that window.onload is recognized as a function initially, then you see the "Test" alert. When you click on the heading, you'll see that window.onload is now an <code>object</code>. I tried iterating through the properties of the object, but it's empty. This is not cool.</p> <p>One lame workaround is to grab the function in the accessible scope and assign it to a different property that you can fire at your convenience...</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Test by Josh&lt;/title&gt; &lt;script type="text/javascript"&gt; window.onload = function() { alert("Test"); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;h1 onclick="window.onloadfix()"&gt;Test&lt;/h1&gt; &lt;!-- Could potentially be injected via server-side include if needed --&gt; &lt;script type="text/javascript"&gt; window.onloadfix = function() { window.onload(); } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I can't think of any other way to address this issue right now.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload