Home > Article > Web Front-end > HTML5 Guide (2) - Detailed introduction to operating Document metadata
Today’s content is about how to operate documentobject.
1. Manipulate Document Metadata
First let’s take a look at the relevant attributes:
characterSet: Get the encoding method of the current document. This attribute is Read-only;
charset: Get or set the encoding mode of the current document;
compatMode: Get the compatibility mode of the current document;
cookie: Get or set the cookie of the current document Object;
defaultCharset: Get the browser's default encoding method;
defaultView: Get the window object of the current document;
dir: Get or set the text alignment of the current document Method;
domain: Get or set the domian value of the current document;
implementation: Provide information about supported dom features;
lastModified: Get the last modification time of the document (If there is no last modification time, the current time is returned);
location: Provides the URL information of the current document;
readyState: Returns the status of the current document, this property is a read-only property;
referrer: Returns the document url information connected to the current document;
title: Gets or sets the title of the current document.
Let’s look at the following example:
<!DOCTYPE html> <html> <head> <title>example</title> </head> <body> <script type="text/javascript"> document.writeln('<pre class="brush:php;toolbar:false">'); document.writeln('characterSet:' + document.characterSet); document.writeln('charset:' + document.charset); document.writeln('compatMode:' + document.compatMode); document.writeln('defaultCharset:' + document.defaultCharset); document.writeln('dir:' + document.dir); document.writeln('domain:' + document.domain); document.writeln('lastModified:' + document.lastModified); document.writeln('referrer:' + document.referrer); document.writeln('title:' + document.title); document.write('');