Over the past few months I have been discussing progressive enhancement with some of my clients. For some reason there seem to be real friction about how to safely integrated JavaScript to provide web 2.0 style web design but to ensure that the site provide a similar experience for users with older browsers or with JavaScript disabled.

While this is a bit of a mute point as pretty much consistently over the past 5 years 90% of browsers have JavaScript enabled, it is essential to be aware of progressive enhancement for accessibility reasons.

So here is a quick example using asp.net MVC and jQuery to provide overlay style popups which degrade to a post back model if JavaScript is disabled.

View Code HTML

<!-- Create a link labeled 'show overlay' which uses the 'ShowOverlay' action of the 'home' controller-->
<p><%= Html.ActionLink("Show overlay", "ShowOverlay", "Home")%></p>

<!-- Above the closing body tag include the following code -->

<% if ((bool)ViewData["ShowOverlay"] == true)
   { %>

        <div id="panel">
            <div id="Div1">
                <%= Html.ActionLink("Close", "CloseOverlay", "Home")%>
            </div>
            <div id="content">
                <h2>Overlay header</h2>
                <p>Dulce et decorum est pro patria mori</p>
            </div>
        </div>
        <div id="mask"></div>
<% }%>

View Code - JavaScript

/*On page load bind the 'ShowOverlay' function to click 
  events of the 'show overlay' link and close link. */

var PageReady = function() {

    var ShowOverlay = function(State) {
        if (State.data.show == true) {
            jQuery("body").append('[Panel HTML]);
            jQuery(".close").bind("click", { show: false }, ShowOverlay);
        } else {
            jQuery("#panel").remove();
            jQuery("#mask").remove();
        };
        return false;
    };

    jQuery(".overlay").bind("click", { show: true }, ShowOverlay);
};

jQuery(document).ready(PageReady);

Essentially this is all the code you need to degrade the user experience. If JavaScript isn’t available the click events will never be bound to the link and therefor the page. will degrade to use a post back model.

However we need to create some code in our ‘home’ controller to show or hide the overlay on post back.

Controller - Actions

public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewData["ShowOverlay"] = TempData["ShowOverlay"] == null ? _
                false : TempData["ShowOverlay"];
            return View();
        }

        public ActionResult ShowOverlay()
        {
            TempData["ShowOverlay"] = true;
            return RedirectToAction("Index");
        }

        public ActionResult CloseOverlay()
        {
            TempData["ShowOverlay"] = false;
            return RedirectToAction("Index");
        }
    }
}

There are a couple of thing happening in the his example i’d like to discuss.

When we click ‘ShowOverlay’ the action ShowOverlay is invoked but i don’t want the URL to change to ‘home/showoverlay’ to get round the automatic URL rewriting I set TempData[“ShowOverlay”] to true and return to the ‘index’ action.

Currently the only way i know how to pass data between controller actions is to store the value in TempData, which i can then pass into ViewData in the target controller action to return to the view.

The second in the controller action is a lazy piece of code which sets ViewData[“ShowOverlay”] to false if TempData[‘ShowOverlay’] is null i.e. we never clicked the show or close links.

And that’s it - all you need to know to degrade a web 2.0 style overlay using progressive enhancement.

Take a look at an example page, where you can download the JavaScript and CSS.

Microsoft finally catch on

| 0 Comments | 0 TrackBacks

Something truly remarkable has happened.

Scott Gu has announced that jQuery is to be shipped with Visual Studio.

"I'm excited today to announce that Microsoft will be shipping jQuery with Visual Studio going forward. We will distribute the jQuery JavaScript library as-is, and will not be forking or changing the source from the main jQuery branch. The files will continue to use and ship under the existing jQuery MIT license.

We will also distribute intellisense-annotated versions that provide great Visual Studio intellisense and help-integration at design-time.

We will also extend Microsoft product support to jQuery beginning later this year, which will enable developers and enterprises to call and open jQuery support cases 24x7 with Microsoft PSS."

Well I'm glad to hear that Microsoft have finally caught on. I personally have been using jQuery as my JavaScript framework of choice since version 1.0.4.

For those of you who haven't heard of jQuery, it's a very lightweight cross-browser framework that easily allows you to manipulate the DOM to create JavaScript transitions etc.

For example, if you wanted to add some error text to a div you would write:

 var ShowJqueryError = function() {
    $('#ErrorMessage ul')
        .append('<li>Please enter your login name</li>')
            .parent()
                .show();
 };

This piece of jQuery will find the UL element which is a child of divErrorMessage and append the li error message to the list.

The quickest way to achieve the same effect with native JavaScript is:

var showError = function() {
    var errorDiv = document.getElementById("ErrorMessage");
    if (errorDiv !== null) {
        var errorList = errorDiv.getElementsByTagName("ul")[0];
        errorList.innerHTML += '<li>Please eneter your login name</li>'
        errorDiv.setAttribute("style","display:block");
    }        
 }

The two main reasons I chose to adopt jQuery as my JavaScript framework of choice were:

  1. It's cross-browser compatible out of the box, which means I don't have to write bucket loads of code to ensure a consistent browser spread.
  2. The selector style language (ID and class named base) is so close to CSS that the overhead of adopting it was low.

An added bonus is that it's quite fun to use too. Making it, for me at least, the best tool for the job.

Microsoft's support for jQuery is monumental, indicating a further shift in their attitude away from a command and conquer mind-set to creating the best development environment, whatever the tools.

Cross domain scripting - Flash

| 0 Comments | 0 TrackBacks

Once upon a time the internet was quite a simple little place where every interaction required synchronous transaction between the client and the server.

You entered some information in to a form, pressed a button and the page was sent to a server somewhere for processing. The results were returned to you when the page reloaded.

Life was simple: Post - get response - reload page and move forward on your merry way.

Then JJG decided to blow the whole model apart by creating a cool name for XMLRPC (AJAX).This very simple act changed the 'transactional' nature of the web. It was no longer cool to wait for a the whole page to refresh; people expected portions of web page to load asynchronously.

This new world of website has created a bit of a headache for the security bods because accompanying this new transaction model was a 'hailstorm' of new web services; little code islands a developer can contact to get information on everything from book reviews to weather forecasts to bank statements.

The thing that troubled the security bods now was how to ensure the credentials of the web sites connecting to a web service.

The answer was to enforce a sand box in the browser to prevent websites outside of the domain to connect to the web service. Very cool, except most web developers want to use web services from Amazon etc.

One easy way to get round this was to use Flash as a conduit for the AJAX request. However, Adobe have been very busy updating the Flash Plugin to enforce a tighter security model. This process started by requiring the presences of a crossdomain.xml file on the web service root.

At first, all you were required to do was include the following lines of code:

<cross-domain-policy>
    <allow-access-from domain="*" secure="true|false"> 
</cross-domain-policy>

So, OK, you can provide a domain name or IP address in the domain attribute to only allow access from a specific domain, for closed access.

With the introduction of Flash Player 9, Adobe have started to tighten the security model. Now you are required to specify accepted request headers:

<cross-domain-policy>
    <allow-access-from domain="*" secure="true|false" />
    <allow-http-request-headers-from domain="*" headers="*" secure="true|false" />
</cross-domain-policy>

And with the launch of Flash Player 10 the security is going to be even tighter. The culmination of all these changes is that a lot of Flash applications have the potential to stop working if the crossdomain.xml file hasn't been updated in line with the changes to Flash's security model.

Broken window's are everywhere

| 0 Comments | 0 TrackBacks

In User Experience in a software development team I wrote that developers have their part to play in good product usability. I proposed that by getting all developers to understand about good business tier usability they would be more open to the User Experience mindset and would therefore consider the "user" in their UI design.

I developed this theory by reading The Tipping Point by Malcolm Gladwell, in the book Gladwell discusses the Broken Window or Zero Tolerance approach to crime prevention adopted by Rudy Giuliani in New York City in the early 90’s.

Under this approach Giuliani instructed the police to strictly enforce the law with regards petty crimes such as:

  • Subway fare evasion
  • public drinkers
  • and graffiti artists etc.

Soon after rates of both petty and serious crime fell suddenly and significantly, and continued to fall over the following ten years[1]. The theory is that by creating an environment where petty crime can’t flourish serious crime would also stop. Crime would remain low due to more high profile policing and social constraints.

In User Experience in a software development team I highlighted one type of broken window that of user experience; reduce bad development decision in the lower tiers through an incomplete mindset and that should reduce the impact of bad decisions in user interface tier.

Now I would like to highlight some other broken windows that should be consistently guarded against.

These are:

  • Don’t leave broken links in your site.
  • Ensure the your web pages adhere to a published grammar i.e. they are XHTML compliant
  • Developers should test their own work

Don’t leave broken links in your site

Broken links are a clear signal to your client that you don’t care about their project. After all, you couldn’t even be bothered to understand their content enough to ensure that they don’t look stupid in front of their customers.

The bottom line, whether we want to admit it or not, is that all web developers should be concerned about “brand”. Clients have the expectation that you’ll be responsible for their online brand and don’t take kindly to you making them look unprofessional. Don’t moan about it, take the opportunity to create a proactive relationship with your client and fix those links, help to make your client look more professional.

Ensure the your web pages adhere to a published grammar i.e. XHTML compliance

I’m not a standards nut, but ensuring that your page is compliant with a published grammar helps with the following.

  1. Most modern browsers know how to interpret properly structure code and will pretty much display what you want how you want it.
  2. Accessibility is important. Compliance to a grammar is one big tick for adhering to the accessibly guidelines.
  3. Good grammar helps with SEO.

Start getting it right now, validate every page and don’t move on until it adheres to the doctype declared in your page header.

Developers should test their own work!

I can here cries of heretic from my development fraternity – but before you storm my house with pitch forks and flaming torches let me explain.

It’s a truism that most developer aren’t that good at testing their own work properly, they know what work and will test to make it work but honestly having debug messages flash up on a live system is just bloody lazy.

You are responsible for ensuring that your code is at production quality no one else. Stop the belly aching, take some responsibility.

Any more for any more?

The development activity like most creative tasks has the potential to create many different broken windows. What’s important for one project isn’t important for another. The key is to start to take responsibility for your actions. Know how what you do affects your client, their customers and their perception of you. Identify you own broken window and be proactive learning how to fix them.

[1] This is debated, in Freakonomics, Levitt and Dubner argue that the fall in crime was due to the legalisation of abortion in 1973. The crux of their argument is that there were fewer 16 – 25 year old males from impoverished families, those most likely to commit crime, around and therefore less people committing crime.

The Myths of innovation

| 0 Comments | 0 TrackBacks

In the Myths of innovation Scott Berkun analysis the what works and doesn't work in creating innovative products.

He looks at the Myths that surround innovation and breaks the process down to a pragmatic guide to creating the space to be a more productive innovator. Written in a relaxed style you'll plough though the book in no time at all, and come away inspired.

Anyone who wants to go further in software/product/web design should read this book.

Also, don't forget to read the Colophon as with all of Scott's writing it's a treat.

When I grow up I want to be Clive James....

| 0 Comments | 0 TrackBacks

or at least I want to be rich enough to have his library!

I've been fascinated by Clive Jame's art world TV Series Talking in the library. It's what main stream TV should be; Interesting people talking about interesting things!

To find out more check out the background to the series and a full video archive via Slate.

Rocky Balboa

| 0 Comments | 0 TrackBacks

A strange fact that most people don't know about me is that I love the Rocky films, even Rocky V which was dismal. Last night I finally found the time to watch Rocky Balboa, the six installment in the Rocky franchise.

Despite some of the cynical reviews I personally thought it was a treat of a film to watch; back to it's roots, gritty and unpretentious.

One bit that resonated with me was the scene when Rocky is talking to his son about life...

"Let me tell you something you already know.

The world ain't all sunshine and rainbows. It is a very mean and nasty place and it will beat you to your knees and keep you there permanently if you let it. You, me, or nobody is gonna hit as hard as life. But it ain't how hard you hit; it's about how hard you can get hit, and keep moving forward. How much you can take, and keep moving forward. That's how winning is done. Now, if you know what you're worth, then go out and get what you're worth. But you gotta be willing to take the hit, and not pointing fingers saying you ain't where you are because of him, or her, or anybody. Cowards do that and that ain't you. You're better than that! "

Kind of sums up my view on the world....

RNIB See it right - Book and CD launch

| 0 Comments | 0 TrackBacks

Tonight I wen to the launch of the new RNIB See it right booklet and CD. It was a rather wonderful evening and hosted in the magnificent City Hall on the south bank of London. (we we're on the 9th floor and had a panoramic view out over the whole of London - very nice)

The highlight of the evening for me were the speeches.

The first speaker was Wayne Trevor of London Underground who talk about the the companies plan to make the underground fully inclusive over the next 10 years. Factoid - London Underground spends more than any other company in Europe on accessibility, how cool is that!

Then it was Michael Wolff of Wolff Olins who gave what I though was a wonderful speech on his time in charge of the Inclusive design challenge.

Then was Hugh Hudd of the RNIB who talked of the personal side of being blind. "Imagine everything you knew is blank, that form you must sign has no writing on it, who would you trust to tell you what you're about to agree to" that's what being blind is like, that's why we must do more to help everyone with disabilities access the information they need, in a format that's suitable to them.

It's nice to get to go to events like this because it helps me to reconnect with my passion for user experience. It helps me to remember the reasons I left a cushy job and decided to start on the path of running my own user experience consultancy because at the end of every website, or software application, or leaflet is a person wanting get on with their life, and who am i to stop them.

For some futher thoughts and comments see the new UX Consultancy Blog

What is usability anyway?

| 0 Comments | 0 TrackBacks

With 57% of the UK population having access to the Internet now has never been a better time to launch a digital product, but research also shows that users have become more impatient. It now takes only 4 seconds for a customer to make a decision about the companies they encounter on the web, and whether they will use their products or services or go elsewhere.

With this in mind, it's never been more important for a company to create a product that meets their customer's expectations. It is essential to create an online experience that will engage the customer so that they feel as quickly as possible that the company not only has the item they want, but they are able to provide it in a way that is quick and simple.

Traditionally, these challenges have been met technically by software developers, websites have become more complex, and through the advancement of web 2.0 technologies there is very little to distinguish between a traditional software application and a website. Alongside the rise of technology and the Internet, a legion of usability engineers have been quietly working to shape the web to become more usable; more inline with customer’s expectations.

We all experience the efforts of these usability engineers but the truth is that most people still don't know what usability actually means and what measurable benefit it will bring to a company.

What is usability?

"Usability is an approach to product development that incorporates direct user feedback throughout the development cycle in order to reduce costs and create products and tools that meet user needs" - What is usability (Usability Professionals Association)

In short, a usability engineer works with product developers to test how easy it is for someone to use their product. This is done many different ways but the most common are:

User testing - a usability engineer will watch people use something and make recommendations on how to improve it to give better results for the user.

Expert review - a usability engineer will review a product and make recommendations on how to improve it to giver better results for the user.

Make sense? Usability touches every part of your life; think about it tonight when you drive home, get through your front door to uncork a bottle of your favourite Chardonnay and relax while listening to your favourite music. The fact that you drove home in comfort and safety, that you got into your house, that you uncorked a bottle of wine, that you can literally listen to thousands of your favourite pieces of music on your MP3 player without even thinking about it, is testament to how much usability touches your life.

Across a study of 863 projects it's been estimated that you can benefit from a measurable increase of 135% by setting aside 10% of your development budget for usability , as well as other benefits such as an increased in brand loyalty and word of mouth marketing.

Products have come a long way over the past 30 years, but there is still much to do. One area of usability that needs to greatly improve is accessibility; from 1st October 1999 it became a legal requirement that "a service provider had to take reasonable steps to change a practice which makes it unreasonably difficult for disabled people to make use of its services".

What is accessibility?

Accessibility is the term that describes a field of usability that aims to explicitly improve the usability of a product for people with disabilities such as visual impairment, dyslexia, hearing impairment, mobility problems etc.

It's no longer acceptable for a company to create a product without providing equal access to everyone. Moreover it's really bad business!! I can't think of any company that wouldn't want some of the £50bn that the 8.6 million registered disabled citizens of the United Kingdom have to spend - or the £175 billion the UK's over-50's have to splash out (most people over 50 have some form of impairment such as deterioration of their sight).

The secret here is that accessibility isn't expensive either, as long as it's designed into your website from the start. A few simple techniques, can give you access to a combined market of 225 billion pounds, and if that isn't good enough...those same simple techniques will make it piece of cake for Google to find and rank your website because Google accesses your website in the same was a visually impaired user with a screen reader does. Optimise for accessibility and your search engine ranking is likely to improve.

The first day of the rest of my life - PART 1

| 0 Comments | 0 TrackBacks

Today was my first full day running UX Consultancy my full services user experience consultancy.

I'm not exactly sure what i expected feel at the end of the day, but I'm glad to say the feelings of blind panic have now subsided and I'm starting to feel that i might acclimatise to the challenges that lay in front

As usual when I'm feeling a little odd, I talked it over with my 4 year old daughter, every night we play a game called - what happened on the way to work, in search of inspiration I usually use what happens in the day to help make up a story.

This is what happened today.

Ellie (e) - Daddy what happened on the way to work?
Me (m) - Today Ellie Daddy got on his horse and ventured in the great unknown, It all started off quite slowly with me checking that I had everything I needed, then off i went. suddenly i came across an enormous mountain. No matter which route I though about taking I realised that my horse couldn't make it. Normally, as you know, I would ask my giant friend to help. Usually I would sit on his shoulder and ask him to take me up the mountain, but today my giant friend was no where to be found. So I started the long climb to the top.
E - Why can you use your TARDIS to fly over the mountain?
M - Ah... right then Ellie good night.