I want to design a site now so it works on EVERY possible computer and device, including mobiles.
Can I use the HTML 5 doctype, code mainly in good old XHTML/HTML 4, but include the odd HTML 5 feature that I want (and use a bit of device sniffing to serve relevant content as needed).
So my pages would always have a HTML 5 doctype, and mainly be XHTML/HTML4 - including using Flash for video - but may use the <video> tag for Apple devices (which I know can support this).
The problem is, will (e.g.) a 3 year old Nokia device that does ok viewing HTML 4 in its browser be able to view a HTML 5 doctype, even though only HTML 4 is served.
I know this sounds silly but as I want all pages served to the same device (easier to manage) it would be more annoying to use different doctypes for different devices when I could do a basic HTML 4 and add HTML 5 where I see fit.
Sure, in Firefox you can flip the pref browser.autofocus to false. (I’m not aware of such a pref in Opera, but in principle it could have it too.)
If google used autofocus=“” instead of focus() then you would be able to disable it in Firefox and it wouldn’t steal focus in Opera if you’ve started to type in the address bar (it appears we’ve fixed that in 10.70 already).
How are you supposed to deal with it if you’re on a new-to-you page with a screen reader: can you override being thrown into the middle of a page before getting a chance to go through the beginning (and use ARIA roles and/or skip links to let those already familiar with the page jump to the main focus if they so choose)?
Yeah I’m mostly thinking of a page like Google’s main: most users who are familiar with it just want to jump to the main search input, but I’d still rather it was user choice not author choice.
I don’t see why the OP can’t
-use the HTML5 doctype
-use some of the other shortcuts in the <head>
-use <video> tags with <object>/Flash fallbacks
-leave everything else HTML4 style
This way, no JS necessary for IE re new tags etc (requiring Javascript to make a browser understand markup is wrong and goes against WCAG), plus you might be able to use some of the new form data types (most of the time, any not understood by the browser is just defaulted back to “text” which is ok).
Only one I’m really against is the autofocus one… If I have a page with autofocus as the home page I do not need it to keep screwing with me when I try to type into my address bar. Autofocus should be something the user can choose, not the author. It’s as bad as tabindex when you’re user a screen reader too. : (
But the others seem pretty cool (and none of my browsers support any of those nor my screen readers lawlz but again, that’s mostly ok because they degrade ok).
So there isn’t a simple <nohtml5> tag that works just like <noscript>?
And to clarify then, it is impossible to use HTML 5 and serve every device and browser (that exists today and with the same HTML files served to each device) without messing around with some silly JavaScript? Is that right?
This is what I want (now I have had further thought). Is this possible?
(1) Use HTML 5 doctype and code in HTML 4. I want all devices (IE6,7 etc. and old mobiles to be able to view pages as they would if doctype was HTML 4). (they would need to say "hey, HTML 5, no problem as long as there aren’t HTML 5 tags).
(2) I would like to use some HTML 5 tags but would like the broswer to show alternative content if it doesn’t support it - similar to how JavaScript (and <noscript>) works where if it supports it then it shows it, otherwise shows alternative content. I would put in the <video> tag and also have flash as alternative.
People using Apple devices would see the <video> tags (HTML 5 browser).
People uising IE8 will see site but get Flash (non-HTML 5 browser).
Then when these IE8 people get IE9 they will automatically see the <video> content not flash.
(and of course I can do this for the new form styling options etc.)
Is this all possible and how would I do the <noscript> side of things? The tag <nohtml5> would be nice, how easy would that be?!
html5 is html 4.01 + xhtml 1.0 + new features (called “html5”).
Eh? HTML5 has nothing to do with XHTML 1.0. If anything, it’s a departure from the stupid XHTML craze and is simply building upon HTML 4.01.
Thanks for that. I should have read this page more carefully, as I can see now I misinterpreted the stuff about moving on to the next source if something isn’t playable and about errors being dispatched.
There are thingies (widgets) people build with Javascript that doStuff(). Stuff like drag and drop, or imitating some desktop app or whatever. Often those move your focus after you’ve completed some part of the task: like moving focus to the area where the thingie was dragged, or moving focus to the new dialogue window that opened. I avoid these things as much as possible but this is the little bit I saw when I started reading about using ARIA attributes for widgets. With those you can choose to tell someone where the next step is, and you can set how insistent your program is in saying that.
If google used autofocus=“” instead of focus() then you would be able to disable it in Firefox and it wouldn’t steal focus in Opera if you’ve started to type in the address bar (it appears we’ve fixed that in 10.70 already).
But if it’s a page you haven’t been to before, and you miss the whole beginning of the page because autofocus was put on some input… that’s what I’m talking about.
If authors are encouraged to add this attribute for the benefit of surfers it seems wrong to say “if it’s making it difficult for you to surf you can crawl through your browser preferences and turn it off” (yeah I know a lot of people have to turn stuff off anyway, but for instance it was very nice of Google to give screen reader users a change to skip or turn off Google Instant… gets announced right when you first get on the page).
In other words does this mean those of us conscious about accessibility for those who aren’t the majority of surfers can’t or shouldn’t use this autofocus because of this issue? Or, is it not an issue (for me, the problem is the addressbar, but if all browsers implement an exception for that, it’s not a big deal… but what about pages you DO want to use? So, you’ve moved your focus into the page to begin reading/listening?)?
I mean we don’t use tabindex for this reason right?
OR is there some place where I can read a lot more about autofocus than what I’ve gathered? Most of the other attributes seem pretty simple and obvious to me but this one bugs me.
That’s exactly why autofocus=“” should be used instead of naive focus() with script. With autofocus=“”, the browser can know that you have moved focus somewhere else, and ignore the attribute. (Opera does this right if you focus some other input field in the page, but not the address bar – we should fix that.)
I think you should learn HTML5 and use it on experimental sites that do not rely on having an audience.
There are many designers who use the HTML5 doctype because it’s shorter and then use HTML element names as IDs (e.g. <section></section> becomes <div id=“section”></div>). I’m not going to judge whether or not this is sensible. I do wonder, however, why you’d want to use the HTML5 doctype without going all the way. If you’re using HTML 4.01 or XHTML 1.0, then why not use the corresponding doctype?
I’d use HTML 4.01 for now. It’s safe and you’re bound to have the least problems that way. But if you have a site aimed at a certain audience, then you can be more progressive (e.g. it’d make little sense for Youtube users to not have Javascript enabled).
Surely the so-called “XHTML5” is the XML implementation of HTML5.
Unless I’m much mistaken, the distinction between XHTML and HTML will still hold true - it’s all about what mime-type you serve the content with. So if you intend to use XHTML syntax then you should still be sending your content as application/xhtml+xml.