Skip to main content

the html5 switch...Interesting!


Depending on who you talk to, you should have been using HTML5 months, nay yearsago; or it's something you might be using in 2022. As usual the truth is somewhere between the glib extremes.

There's no one-size-fits-all answer to questions of platform choice: you have to consider the benefits for your own scenario. But with HTML5 I'd say if you haven't switched yet,for most people it's probably time - there's a form of "switching" that will work for you.
Some people seem caught up on the problem that many features have very poor support across browsers; or are simply put off by the thought of redoing their entire code base.
Really though, you don't have to rebuild everything, not use everything in HTML5 for it to be worthwhile switching your doctype now.
Over the past few months I've switched a large application and a few small sites to run the HTML5 doctype. Most have been seamless, with just one website exploding on contact with HTML5 - it will remain XHTML until it can be overhauled.
So what have I learned doing this? Basically, the decision to switch comes down to:
  • What do you mean by "use HTML5"?
  • Which doctype are you running now?
  • Is there any value to switching?
Seriously, that's it.

defining "using html5"

I'd suggest considering three basic options for "using HTML5":
  1. Switch the doctype, but change basically nothing else.
    • This is a "readyness" move - you're not changing anything now, you're just paving the way. This option is mostly useful for organisations where technical changes are slow and/or political.
    • Generally it should morph into Option 2 reasonably quickly but might be a required stop-off point.
  2. Switch the doctype, then use a subset of the new features.
    • This is what most people are doing right now - cherry picking those things which give you immediate value without too much overhead. Usually this translates tousing features with usable levels of support or where it's easy to provide fallback options.
    • This option is good for iterative change, particularly where you can't easily or quickly replace your entire UI code base.
    • For the average dev shop it's probably the best balance of "new and shiny" and "works within budget".
  3. Full switch: replace your UI entirely with HTML5, using all the features (including new elements).
    • So far this option is most popular with blogs and new or small apps.
    • For many projects it's just not viable - it doesn't matter what flavour of markup is in use, they're not getting redeveloped right now.
    • This option will require bridge solutions like HTML5 shiv - that is, you'll be relying on Javascript for rendering.
Option 3 negates the need to ask the next question, but Options 1 and 2 really need to ask...

which doctype are you running now?

If you're switching doctypes on an existing code base, you need to consider what that is actually going to do. The most relevant differences are:
  1. The rendering mode it sets
  2. The rules the W3C validator will apply
Doctypes also tell humans what kind of code should go in the document, but since it doesn't enforce your actual house style it's a relatively intangible benefit.

rendering mode

HTML5 will set strict rendering mode. If your site or app is currently being rendered in strict mode, happy days. However if it's in quirks mode it's going to hurt; and if it's in almost-standards mode, it's a roll of the dice.
Going from almost-standards to standards mode might be a painless change. Most of my sites were painless; another broke quite badly - particularly because strict rendering made the Cufon headings blow up (beware of the shrink wrap).
I will stress that if you are running in almost-standards mode, you should still try the switch. Do not be put off HTML5, just go ahead with your eyes open.
For more information see:

validation

Curiously, if you have a lot of validation errors already you might find HTML5 actually lowers the number of errors - it's extremely forgiving. Personally I think it's far too forgiving; and it repositions the validator as a tool only for finding gross errors like unclosed divs. For actual code quality you'll need to move away from straight validation and try a tool like HTML Lint.
Also be aware that currently if you use the x-ua-compatible meta tag, the validator considers it to be an error (aside: I've raised this as a bug with the validator team). This means if you support IE with the meta tag, you will never get a green test result. If you are reliant on automated testing this could be an issue.

the value of switching

It's a basic question, but you should ask "will (insert shiny new technology here) actually help me build stuff"? Even if you are convinced already, your boss or clients probably aren't; so you need be able to answer the question.
Personally I think it's unlikely that any web-based project would get zero value from migrating to HTML5, although some might not get as much as they'd imagined.
Web applications get the greatest benefits as HTML5 is extremely app-focused. Also many apps already rely on Javascript, so the JS-based solutions for enabling new features and fallbacks don't change their support profile.
Websites with lots of content will probably get more benefit long term, as support improves for the content-focused stuff like new semantic elements (and associated document outline system). Short term, there are some questions about best-practice usage and how search engines will cope with the new document outline. Also you might not be willing to rely on Javascript just to get your content to render.
A few other points to consider...
  • It's a great base for progressive enhancement and can reduce your maintenance load.
    • eg. common form validation can be handled by HTML5 elements, so you only have to maintain a JS-based fallback for IE... and you can use conditional comments so you only serve it to IE too.
    • Multiply this out and you can make your apps faster and lighter for an increasing proportion of the market.
  • Flipping that around, HTML5 elements make excellent fallback content.
    • eg. I use a Flash audio player on one site; and <audio> gives me a functional fallback on browsers without Flash (including iOS devices). Previously the fallback was a link to the mp3 file. (Jeremy Keith has a great post about using this approach)
    • This approach also removes pushback against using variably-supported features as your core solution - sure it might not be as intellectually satisfying as ditching IE and Flash content users, but it's probably got a greater chance of client acceptance.
  • The simplified syntax is nice to write.
    • <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> or<meta charset="utf-8" /> ...I can remember only one of these off the top of my head, how about you? :) 
  • Curiously, HTML5 seems to open a new development mindset - switching can be a catalyst for using a swathe of new standards. Sure, it's smoke and mirrors, but you might even be able to push a couple of crap browsers off the bottom of your support chart too.

last thoughts

In its purest form, a platform change decision comes down to how much value you get (or the cost of not changing) vs. the cost of the change. For most people the cost of switching to HTML5 will be trivial, so the long-term benefit of merely being ready to use more features is enough payoff.
If you are kicking off a project today and building from scratch, you should definitely use HTML5 - even if it's mostly plain old (X)HTML despite the new doctype. If you're maintaining an existing app, you may as well switch out the doctypes so you can start legitimately cherry picking new features as you have time and opportunities.
I have no idea what we'll be using in 2022. It probably won't be HTML5 any more. But in 2011, I'm using HTML5.

Comments

  1. GGPoker Slots Casino - Jtmhub
    GGPoker 충주 출장샵 Slots Casino 울산광역 출장안마 has a collection 대구광역 출장마사지 of online slots that are made available from this software 안동 출장샵 provider. Check out our full selection and get 춘천 출장샵 an exclusive

    ReplyDelete

Post a Comment

Popular posts from this blog

Expose your Local Development Environment to the outside world with Ngrok

When we develop on localhost, we usually use some kind of simple HTTP server like node, our Oracle database,APIs, webhooks, Callback Urls or whatever. This is all good and we are all pretty happy about that. We have access to our app using our fancy  http://localhost  url. We are happy, but  alone . What if you would like to share your app to a colleague that is not on the same network as yours ? What if you need to check your app on an SSL connection? What if you wanted an external system to pass you a process invoked by a method ? ngrok to the rescue Ngrok   is a simple “free” service that can help you with that. Here’s some of the features that it provides: Expose your locally hosted app/website to the outside world by providing you a  http(s)://{something}.ngrok.io  url. Allows you to have an SSL connection to your localhost environment. Inspect/replay the requests made to your local environment Custom subdomain (required a premium accou...

Disabling of Password Expiration in Oracle Apex(Internal Workspace Admin)

This post was inspired by a  question  on the OTN APEX forum, which contains how to  reset set the password of the  Oracle Internal Workspace Admin    and  Set the account never to expire  The first bullet has so many blogs  talk about how to reset the password of the Internal Workspace. However, i am more intrigued with the second . To start of with It is not advisable to never expire accounts since its rudimental for user to always renew their accounts  prior to expiration. The default expiration of an account is mostly 180 days so hey whats the point going to do this again after 180 days?? . There are two methods that can be used to achieve this  Generic Never expiration of all User accounts (This should never be practiced in a production Environment All database users are assigned to something called a PROFILE . The profile controls two aspects of the users database acce...

How does one add a day/hour/minute/second to a date value?

DATE is the datatype that we are all familiar  with when we think about representing date and time values. It has the ability to store the month, day, year, century, hours, minutes, and seconds. It is typically good for representing data for when something has happened or should happen in the future.  The problem with the DATE datatype is its' granularity  when trying to determine a time interval between two events when the events happen within a second of each other. This issue is solved with the TIMESTAMP datatype. In order to represent the date stored in a more readable format, the TO_CHAR function has traditionally been wrapped around the date: SQL> SELECT  TO_CHAR(hiredate,'DD.MM.YYYY:HH24:MI:SS')  "hiredate"   FROM employees; hiredate ------------------- 17.12.1980:00:00:00 20.02.1981:00:00:00 The SYSDATE pseudo-column shows the current system date and time. Adding 1 to SYSDATE will advance the date by 1 day. Use fractions to add hours...