Archive for August, 2008

Warn users about unsaved changes in a web form

Sunday, August 24th, 2008

[This originally appeared on my dev2dev blog 29-Jan-2008]
Here is the proper way to warn users so they don’t loose changes by accidentally navigating away from a form.
Continue reading…

Semantic markup - a difference you can hear

Saturday, August 23rd, 2008

[This originally appeared on my dev2dev blog 20-Nov-2007]
One of the often cited benefits of semantic markup is improved accessibility. It is not a guarantee that if you use semantic markup that your page will be accessible but it helps and when you do find accessibility problems they are easier to fix.
Continue reading…

Using JSLint from Ant

Friday, August 22nd, 2008

[This originally appeared on my dev2dev blog 16-Nov-2007]
Here are instructions for using JSLint from Ant to check your JavaScript for common potential problems.
Continue reading…

Time to get serious about JavaScript

Friday, August 22nd, 2008

[This originally appeared on my dev2dev blog 16-Nov-2007]
Making web applications today means incorporating some amount of ajax and that means using JavaScript. Here are some pointers for bringing good engineering practices to JavaScript.
Continue reading…

WLS Console beauty more than skin deep

Friday, August 22nd, 2008

[This originally appeared on my dev2dev blog 10-Nov-2007]
Best practices lead to performance improvements in the Tech Preview WLS Admin Console.
Continue reading…

IE6 iframe with no src over SSL solution

Friday, August 22nd, 2008

[This originally appeared on my dev2dev blog 9-Nov-2007]

The WLS Admin Console is not yet using an ajax library but it does do a few asynchronous things with an iframe. The iframe had the src attribute pointing to an empty html file. I didn’t like this wasteful and pointless round trip to the server so I removed the src attribute.

Then someone testing over SSL on IE6 rightly complained that the browser was giving a “This page contains both secure and nonsecure items” warning message.

Turns out that IE6 has a problem with iframes without the src attribute. This has been fixed in IE7. Some people recommend always using a src attribute but I’m trying to squeeze every bit of performance I can out of Console.

I thought I found the solution here. Looks like dojo solved the problem using src=”javascript:false”. This does make IE6 happy but now I get a JavaScript error in Firefox. The error I got was “Component returned failure code: 0×80004005 (NS_ERROR_FAILURE) [nsIChannel.open]”

I started wondering if dynamically adding the iframe would solve the problem (I still don’t know). Adding to the DOM the right way means updating the DOM as soon as it is ready. All the ajax libraries support some kind of onDOMReady event but as I said we’re not yet using a library. This got me wondering how onDOMReady works so I started searching and found Dean Edwards solution and more explanation - a very interesting read. Something in one of the code snippets caught my eye - a script element with src=javascript:void(0). The intent is to use a deferred script element without actually loading an external file to detect when the DOM is ready in IE. This gave me the right incantation for my iframe problem.

The final solution that makes IE6, IE7, and Firefox happy is src=”javascript:void(0)”. The void operator returns undefined which is quite different from false. This is a standard technique for the anchor href attribute so it makes sense that it would work in this context also.

[Update 6-Feb-08 It seems a recent Microsoft security update (around Nov-07) has made the IE6 problem worse. The solution given in this article does not work after IE6 is updated. IE6, after the update, considers src=”javascript:void(0)” to be non-secure content.

Now the only solution I know of is to dynamically add the iframe to the document with a src attribute. I’m now doing this
and it works fine]