- 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 HTML5 tag can be used to embed an external application (SWF, PDF) in web page?
<mark> <embed> <canvas>
<embed src="flash_game.swf" width="450" height="350" />
Which CSS pseudo-element adds a special style to the first line of a text?
:first-letter :before :first-line
#id:first-line {
  font-weight: bold;
  color: blue;
Click on the window object property which gets or sets the URL of current page.
window.location window.self window.status
var url = window.location;
Indicate the PHP function used to get the contents of a file or page and store it into a string.
fopen() file_put_contents() file_get_contents()
$homepage = file_get_contents("http://coursesweb.net/");
echo $homepage;
The history object

Last accessed pages

  1. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (83165)
  2. querySelector and querySelectorAll (11854)
  3. Select in MySQL, Output results in HTML Table (9563)
  4. PHP getElementById and getElementsByTagName (31493)
  5. JavaScript code and PHP (26046)

Popular pages this month

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