The Doctor is in with another round of patient questions about HTML5. This week, we’ll cover offline viewing on requests, the drag-and-drop API, using href
on any element, the <figure>
element, and headings.
Offline viewing on requests
Johan asked:
It is possible to let Firefox 3.5/3.6 save a page for offline viewing with the manifest file?
In that case Firefox asks for permission to save the site the same second you arrive – not very user-friendly.Is it possible to send the save-it-locally request via Javascript on a click?
Basically I want a link/button which will fire the request – and not on document load.
While it isn’t possible to make Firefox 3.5/3.6 save a page for offline viewing with the manifest file, there is a way to do this. It all depends on how you write the “save-it-locally request” code. You have two options:
- If you want to store an arbitrary document that is not explicitly listed in your manifest, you could run an Ajax request for that document and store its contents in
localStorage
. When you want to view that document, load it fromlocalStorage
and overlay it on the existing page. - Dynamically manage a manifest file for individual users, so that if a user requests a new file that isn’t in their manifest, register this on the server side and add it to the manifest — which is bespoke to this specific user — on the fly.
I’m not sure what you’re seeing with regards to the permissions error. When I test the manifest (offline **cache**), it doesn’t ask twice.
Note: you asked about Firefox 3.5 — the offline manifest doesn’t work properly at all in this version.
Thanks, Remy
Question about dragging
Marc asked:
Evening,
I’m trying to get my head around the drag and drop (DnD) possibilities of HTML5. I have a “simple” task: Read the content of a XML file, using JavaScript, and do some manipulations of he XML. Without the use of server side scripts.
I tried my way with Google, but apart from people complaining about the DnD specs, I wasn’t able to find much insightful informations.
Can you point me toward resources to understand the DnD possibilities of HTML5?
Thank you Doctor, a French canadian HTML5 fan ;)
Absolutely! There’s actually an HTML5 Doctor article covering native drag-and-drop. It also includes links for further reading and related posts (such as accessibility experiments).
I hope that helps.
Cheers, Remy
About the href
on any element
Luan asked:
I’ve heard a long ago that href would work in any tag, such as a
<p href="...">
or ah1
, even adiv
and others… but I don’t see anything about this in the last days. Do you know if this is going to work?
That was in XHTML2 (on which the W3C have now stopped work).
The HTML5 equivalent is to wrap an <a href="...">
around the other tags. It’s called block-level linking, and we’ve written an article about it.
Cheers, Bruce
W3C Validator for the <figure>
element
Fjpoblam asked:
I have a (prospective) structure containing 8 figures: each an image with a caption. My goal is an image gallery, each image clickable toward an individual htm file containing a slide show. (In html4 I structured each “figure” as a div: figure seemed ideal for the task.)
Problem is, I tried to follow the *validator* hint with a dd for the image and a dt for the caption (each surrounded by an a). Upon doing so, the validator pops up an error. When I try a straight image with a legend, it is also rejected for want of a dd and an optional dt.
What gives? Do you have a hint? Or better, simply, point me doofus to the correct doc so’s you’ll “teach a man to fish”.
I’m not sure if the validator is up to date or not, but you shouldn’t be using <dd>
/<dt>
in <figure>
anymore. Please use <figcaption>
.
See our article on the <figure>
and <figcaption>
elements for more.
Also see our glossary for more examples.
Cheers, Rich
Headings
Thomas asked:
Dear Doctors,
you covered the new
header
tag in an article. Theheader
tag should contain a heading element, like h1-6. So far so good, but how do I structure my headings further on. E.g. I’ve got this:<article> <header> <h1>My major heading</h1> <h2>Subheading</h2> Abstract text... </header> ... lorem ipsum .... <hX>Heading within my article</hX> ... dolor sit amet ... <hX+1>Subheading in my article</hX+1> </article>
Which heading-level would be appropriate in my example? h1 because it starts again? or h3 because it continues?
Thank you
If the first <hX>
is a new subheading and not related to the <h2>
already there, then <hX>
would be an <h2>
. Then <hX+1>
would be an <h3>
if it is a subheading of the above <h2>
.
However, if you’re splitting the article into sections, then you could use an <h1>
each time. See our article on the section element for more.
Thanks, Tom
Got a question for us?
That wraps up this round of questions! If you’ve got a query about the HTML5 spec or how to implement it, you can get in touch with us and we’ll do our best to help.
8 Responses on the article “Your Questions Answered 9”
[…] This post was mentioned on Twitter by Rich_Clark, html5laboratory, Tim Brook, Steve Worsley, Sérgio Rodrigues and others. Sérgio Rodrigues said: Your latest round of #html5 questions answered: http://migre.me/EPSM (Via @html5doctor) […]
In the “Headings” question, given that the string for the h2 reads “subheading” it looks like the two headings in the
<header>
element should be wrapped in an<hgroup>
element.@Nicolas Yeah, you’re right there but that was the code example Thomas sent. However we could add it to the reply. Thanks.
I think what Johan meant was that Firefox asked to save the data as soon as you land on the page, and he wants to know how to not trigger that question until after some user event.
It is strange to have your browser ask you to save this page for offline viewing when you haven’t even read said page yet.
In any case, Remy’s suggestions are still great.
@Fjpoblam
If you use a Definition List with the sequence
dd
+ adt
element used as a caption, the HTML 5 Validator will send an error:HTML 4.01 accepts that sequence.
My thoughts about question Offline viewing on requests
Is it better to use some client side frameworks to load only new data and store only files like images, js files etc. with manifest file.
You can see demo on http://typo.galileoagency.sk in offline section. I have used JavascriptMVC framework, webdatabase storage and manifest.
[…] Your Questions Answered 9 […]
is it possible to cache user control(.ascx page) using app.manifest.?
Join the discussion.