Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

Accessing cookies with application/xml+xhtml

I’m completely stuck on this one. When serving XHTML documents to Mozilla as application/xml+xhtml, the available DOM is for an XML document rather than an HTML document. This means it’s missing the document.cookie object normally used to access cookies from Javascript. I can’t figure out how you access cookies without it (I’ve searched Bugzilla to no avail). Anyone got any ideas? I sure wish the Mozilla project provided better documentation on this stuff.

This is Accessing cookies with application/xml+xhtml by Simon Willison, posted on 3rd July 2003.

View blog reactions

Next: Nail, Bang, Head

Previous: Scribbling.net web site tips

13 comments

  1. It looks like bug 111514 is related to this.

    Jim - 3rd July 2003 10:25 - #

  2. There should be guideline for the DOM especially for the xml dom.

    Sidenote: XHTML, HTML, XML are not an acronym!

    Anne van Kesteren - 3rd July 2003 12:50 - #

  3. I know; I'm afraid I'm bowing down to IE on that one. Besides, just using <acronym> does have the distinct advantage that I don't have to think about the difference between the two whenever I use them.

    Simon Willison - 3rd July 2003 13:24 - #

  4. I could be mistaking, but if I recall correctly you are not using the right header. Instead of application/xml+xhtml you should use application/xhtml+xml.

    I experienced the same problem a while ago. This header will still cause problems up to Mozilla 1.4 (or somewhere near that release) but since Mozilla 1.4b the browser will make the HTML DOM available instead of the XML DOM.

    I hope this will clear thing up for you

    Bas Hamar de la Brethonière - 3rd July 2003 14:23 - #

  5. Ps. Your comments form seems to freak out when I enter è as part of my name... ;)

    Update: it won't allow me to input the character as egrave and it won't turn it into a html entity by itself... Maybe something you could work on?

    Bas Hamar de la Brethoniere - 3rd July 2003 14:30 - #

  6. A quick bit of Googling yielded this possible solution, using XSL. I don't understand any of this stuff so forgive me if I'm way off base.

    Simon Jessey - 3rd July 2003 15:08 - #

  7. Jacques Distler has written about this (http://golem.ph.utexas.edu/~distler/blog)

    Check out his blog and search for "cookies"

    PS: the fields of your comment form are run together strangely (in Camino).

    Adam Rice - 3rd July 2003 18:02 - #

  8. Anne:

    Why are they not acronyms? Because people typically don't spell them out, or because they don't only use the first letter of each word? (e.g. eXtensible, HyperText)

    Joe

    Joe Grossberg - 3rd July 2003 18:16 - #

  9. You spell them out that's why ;). Solution for IE: http://www.sovavsiti.cz/css/abbr.html

    An example of an acronym is WaSP. You can just use it as a word, but it also means something: "The Web Standards Project". I hope this clears out this things.

    Anne van Kesteren - 3rd July 2003 21:12 - #

  10. So it's said. Another example would be ANZAC. But the definitions are disputed and XHTML 2 will likely get rid of the distinction to simplify matters anyway.

    The inimitable Ian Lloyd has more information on acronymns and abbreviations, including a note on why you should use them and a tool for generating them.

    Michael - 3rd July 2003 22:09 - #

  11. You need to update to a more recent version of Mozilla; see here for details. You also need to know that you can no longer "hide" scripts in XML comments. XML comments are strictly ignored when served as application/xhtml+xml, so remember to uncomment your scripts.

    Jacques Distler - 4th July 2003 19:37 - #

  12. oink oink gabba gabba hey

    cvbcvb - 30th January 2005 15:12 - #

  13. To Bas Hamar and Simon:

    There is an encoding problem on this blog. Firefox sends form content in UTF-8 but it appears to be interpreted as iso-8859-1 on the server side. So on the preview page, the e-acute, for example, is encoded twice as UTF-8. If you do more preview, it is worse.

    Olivier Mengué - 11th July 2005 13:58 - #

Comments are closed.

Previously hosted at http://simon.incutio.com/archive/2003/07/03/accessingCookies

A django site