Heal Your Church WebSite

Teaching, rebuking, correcting & training in righteous web design.

encodeURI v. escape with a little IE7 kvetching thrown in

Jimminy Christmas Batman … not like the final release of IE7 yesterday isn’t going to break just about every CSS-driven faux, 3 column website in the land that doesn’t use clearfix

But I’m still dealing with a situation where some users on a site I’m developing are Mac MS IE 5.2 impaired!

Today’s challenge was to figure out a work-around to encoding a URI since pre-MSIE 5.5 browsers are sans the encodeURI function – and since I refuse to put out a tainted link on said site.

The solution? Detect if encodeURI exists and if it doesn’t, use the more deprecated escape function. As such:

/* javascript */
function MyEncodeURI(sBuf) {
sRet = sBuf;
sRet = encodeURI(sBuf);
sRet = escape(sBuf);
return sRet;

Simple enough, but bothersome enough as it took me forever to Google my memory to remember the try-catch approach in Javascript since no one else out there seems to be similarly afflicted with such sizeable issue with such a simple solution.Now if you don’t mind, I need to ‘prepare my sites for IE7‘ … even though one would think that the onus would be on MSFT to fix any w3c CSS not-so-compliant-issues that cause their new browser to gag-up like a kitty-choking on a furball.


  1. I think there _has_ to be a cutoff point with something like old versions of IE where we simply say ‘enough is enough’. And as for MS fixing IE to be fully compliant, I doubt it’s ever going to happen – they gain too much leverage from it.

  2. Oh, and great to see you post again :) I’ve missed the old frequency of posts.

  3. Dean, so glad to see you back here. I was ready to delete the place from my bookmarks.