Out of Hanwell

June 27, 2006

Using window.onload over HTTPS

Filed under: Internet Explorer — Matthias Miller @ 2:36 pm

Rob mentioned that the window.onload solution generates a secure/nonsecure warning when used over a secure connection. This is because the script’s src references the “javascript:” scheme instead of “https:”.

I pointed the script’s src to “https:///”, a URL that obviously does not exist, and ran the script against several automated and manual tests. Oddly, onreadystatechange no longer gets fired for the “loading” state, but all tests did pass as expected. (These were the same tests that I used to verify the original proposal.)

I would have posted a comment on Dean’s blog to interact about this, but it looks like his site is temporarily unavailable. I’ve done my best to test this and it works for me, but let me know what you all find.

Update: This does not work in IE7b3 because of a regression in URL resolution. It attempts to resolve “https:///” relative to the current domain, thus loading “https://domain/” instead. After some testing, I found that it does not attempt to resolve invalid IPv6 URLs, such as “https://%5B%5D/”. Also, the URL scheme is optional, so the script can point to “//[]”.

Update: Internet Explorer 6 does try to resolve “//[]”. Alistair Potts suggested using “//0” instead–which appears to be the equivalent of “//”, based on behavior in IE7–and later pointed out that Internet Explorer does not even attempt to resolve “//:”. Firefox, however, does attempt to resolve “//:”, causing an inconvenient status until it times out.


April 17, 2006

More Details on the “Operation Aborted” Error

Filed under: Internet Explorer — Matthias Miller @ 12:45 pm

Quite a while back, I mentioned a strange “Operation Aborted” message in Internet Explorer. My description, however, too specific. This error seems to occur whenever an element is appended to another element that has an incomplete child element. It appears to be some kind of consistency check that is triggered when a script finishes execution.

Take the following example:

<div id="outer" style="color: green">
<div id="inner" style="color: red">
<script type="text/javascript">...</script>

Given this example, the script can add elements to “inner” because it has no incomplete child elements, but it cannot add elements to “outer” because the “inner” element is incomplete. Likewise, the script cannot add elements to document.body because the “outer” and “inner” elements are incomplete.

To work around this problem, find the outermost element that the script needs to modify. Make your script a direct child of that element or place your script completely outside that element.

Blog at WordPress.com.