Since XHTML documents SHOULD be served as "application/xhtml+xml", and the XML DOM document object has no "cookie" (among other missing features), what's the cross-platform alternative to using document.cookie?
S开发者_如何学Goee: http://www.w3.org/TR/2002/NOTE-xhtml-media-types-20020801/
"In summary, 'application/xhtml+xml' SHOULD be used for XHTML Family documents, and the use of 'text/html' SHOULD be limited to HTML-compatible XHTML 1.0 documents. 'application/xml' and 'text/xml' MAY also be used, but whenever appropriate, 'application/xhtml+xml' SHOULD be used rather than those generic XML media types."
HTML5 has Web Storage, which offers sessionStorage
and localStorage
.
sessionStorage
http://www.w3.org/TR/webstorage/#the-sessionstorage-attribute
localStorage
http://www.w3.org/TR/webstorage/#the-localstorage-attribute
精彩评论