making bbPress (and WordPress) work better!

ajax

List of mobile browsers that support contentEditable (designMode) WYSIWYG

As of March 2011, this is a trick question – NO mobile browser even attempts to support contentEditable/designMode (aka WYSIWYG, rich HTML textareas) on portable devices like cellphones, smartphones, iPad, iTouch, etc.

Desktop browsers have been supporting it since IE 5.5 in July 2000 over a decade ago. The Mozilla 1.3 (Gecko) engine implemented it in late 2002, so Firefox 1.5 had it in May 2003.

Also see: http://caniuse.com/contenteditable

So which one of these will be the first mobile browsers to have it?

Microsoft IE for Mobile
Google Android (Chrome/webkit)
Apple Safari Mobile (webkit)
Opera Mobile
Opera Mini
Firefox Mobile (Fennec)

However I have no information on the brand new Internet Explorer Mobile 9 (aka IE9 Mobile) which was only demonstrated February 2011 by Microsoft.

Since Microsoft invented content-editable, there is a chance they ported it into the mobile IE9 from their newest Trident engine. If anyone can confirm or deny this, please let me know? Thanks!


I swear you can find *anything* on the internet today

I needed a “spinner” for some ajax-ish code I was writing and so I googled and among the first entries was this:

http://www.ajaxload.info/

Let’s you make a spinner from a dozen shapes, any colors, on the fly via web 2.0
Very impressive (and huge timesaver).


stop using “window.onload” in JavaScript

2012 update: this entry is four years old – time for a modern revisit of my old, ugly code – try this instead:

window.addEventListener ? 
window.addEventListener("load",yourFunction,false) : 
window.attachEvent && window.attachEvent("onload",yourFunction);

——————————————–

I don’t write full blown AJAX but I do code some JavaScript from time to time. One big tip I can offer other “casual” javascript coders, since many times a script must be executed after a page is loaded, is to STOP using window.onload=your_function;

The reason for this is simple – you should be APPENDING your script to the page loaded hook, not CLOBBERING any existing scripts that may be already attached. The “window.onload” method can only hook one function at a time and these days it’s common to use several third party scripts on a site. If you are not careful, you may be left scratching your head why something stopped working – because you accidentally stopped it from loading.

There used to be some clever workarounds for this, like making a function that checked onload and appending it to a list of functions to call and replacing it with your own onload. But with modern browsers today, all that mess is not needed. Just replace your code with this (albeit longer) code:
if (window.attachEvent) {window.attachEvent('onload', your_function);}
else if (window.addEventListener) {window.addEventListener('load', your_function, false);}
else {document.addEventListener('load', your_function, false);}

Tested working in all major modern browser (IE, Firefox, Safari, Opera) and it appends instead of replaces the onload process. Hope that helps!


Great Podcast Interview With Joe Hewitt

I’m not typically into podcasts but I highly recommend this one if you’d like to hear an interesting casual interview with a programmer who has affected some of the great web interfaces and tools popular today. Among other feats, Joe Hewitt helped develop Firefox, wrote Firebug, and created the iUI library that brought Safari to the iPhone (he now works for Facebook so expect wonders there too!) The man must be a genius!

ps. I missed the part about “how to turn yourself into a 24 hour coding machine” which would be rather handy 😀 I’ll have to listen to it again or maybe someone can let me know what the secret is (perhaps sleep on your laptop as a pillow? LOL)