JavaScript Off? Check your site…

By | May 7, 2012

Some people, myself included, browse websites with .js turned off. If I need to access a sites javascript features I can easily make an exception on a site by site basis.

What this means is that 90% of sites I visit do not work, or work but look awful. For example, visiting any blogspot blog simply gives a blank page, nice usability Google!

In osCommerce with .js turned off, the vast majority is usable, but some parts appear broken. Two examples;

1. The buttons.

As the look/theme of the button is powered by .js, they react as simple links.

2. The images module.

The multiple images gallery and resizing is powered by .js, so these also ruin the design of the layout.

There are more examples of problem area, but more or less, osCommerce is usable without the need for javascript.

In Magento (shopping cart software), they show a message somewhat like this:

You can see a similar message by visiting any of the shops listed on the Magento Showcase, and turning .js off in your browser.

Adding a similar message to osCommerce…

Step 1. Create an icon.

The icon should be .png format and about 30 x 30 pixels or something like that. Fairly small. Save it into /images/icons/ as filename: no-script.png

Step 2. Add the text for the message

Open up /includes/languages/english.php. Add the following code (open the page, then copy/paste):

Repeat for all languages in your shop.

Step 3. Add the code to the header of your site

Open up /includes/template_top.php. Add the following (open the page, then copy/paste);

Step 4. Applying style to the message.

Open up stylesheet.css. Add the following (open the page, then copy/paste):

That is all.

If done correctly, you should see a message like this;

But remember – the message only shows if javascript is turned off in the browser.

5 thoughts on “JavaScript Off? Check your site…

  1. Isa

    Gary, how interesting, thanks for always sharing tips&tricks to improve our shops 🙂

  2. Gary Post author

    Hi Isa – you are most welcome 🙂

  3. Eddy

    Gary – when you enter a website that only functions fully with js turned on, do you usually browse it anyway without js until you hit something wrong, or you would turn on js as soon as the site suggests you to? For my site, I’m thinking if I should tell the visitor that it simply doesn’t work without js. Is it a bad idea?

  4. Gary Post author

    Hi Eddy – if it’s a site on which I need to have js on, and I want to do something on the site (eg read it if it is a blogspot blog!, or maybe order something on a magento site) then I will turn .js on only for that domain. When I am done, .js is turned off again.

    For sites I completely trust, such as yours, Isa’s, Gmail and so on, I turn .js on for these and leave it on.

    My opinion is that any site that makes use of javascript (and that is most sites these days) should have a message to let the user know (if the user has .js turned off)…

  5. Gary Post author

    Please note that in the .css file, there is an extra “code” tag which should not be in there. So when doing the css change, make sure to remove that.

Leave a Reply

Your email address will not be published.