- The history object is part of the window object, and contains the URLs visited by the user (within a browser window).
It contains useful methods and properties that let you move back and forth through the user's history, and manipulate the contents of the history stack.
- Syntax:


• The history object has two properties: length and state.
window.history.length - returns the number of URLs in the history list.
window.history.state - returns the object added in history with pushState() or replaceState().

Methods of the history object

Daily Test with Code Example

Which tag is used to add lists into <ul> and <ol> elements?
<dt> <dd> <li>
Which value of the "display" property creates a block box for the content and ads a bullet marker?
block list-item inline-block
.some_class {
  display: list-item;
Which instruction converts a JavaScript object into a JSON string.
JSON.parse() JSON.stringify eval()
var obj = {
 "courses": ["php", "javascript", "ajax"]
var jsonstr = JSON.stringify(obj);
alert(jsonstr);    // {"courses":["php","javascript","ajax"]}
Indicate the PHP class used to work with HTML and XML content in PHP.
stdClass PDO DOMDocument
$strhtml = '<body><div id="dv1">CoursesWeb.net</div></body>';
$dochtml = new DOMDocument();
$elm = $dochtml->getElementById("dv1");
echo $elm->nodeValue;    // CoursesWeb.net
The history object

Last accessed pages

  1. Shuffle / Randomize Array in JavaScript (247)
  2. Read Excel file data in PHP - PhpExcelReader (73376)
  3. Dynamic variables in JavaScript (11750)
  4. MySQLDumper - Backup MySQL Database (882)
  5. JpGraph - Create Graph, Charts, Plots in PHP (1605)

Popular pages this month

  1. Making DIV Contents Scroll Horizontally, with multiple Div`s inside (2005)
  2. Contact page - CoursesWeb (1948)
  3. Tabs effect with CSS (1947)
  4. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (618)
  5. Insert, Select and Update NULL value in MySQL (490)