Home TechnologyProgrammingJava Script Subscribe to RSS

What Is History Object In JavaScript?

Answer Question

1 Answer - Sort by: Date | Rating

    JavaScript is a client side scripting language, which is interpreted by the web browsers. JavaScript support many predefine objects and its methods. History object is one the predefine objects. This object keeps track of all the web pages and this record can be used with the help of different methods.

    The history objects support three methods, i.e. back(), forward() and goto(). When a user opens a web page its index becomes zero. When user goes to another page then the previous page's index becomes -1 and the current page's index is 0. This method carries and the visited pages are assigned the index numbers.

    In JavaScript when we use back() method, it means go to one step back. The syntax of this method is history.back(). The forward() method is used when the user has press the back button or the history.back() method is used. The both methods perform same like the back and forward buttons of the browsers.

    The goto() method is used to jump to any page in the history (forward or back). If we use history.goto(-3) then it will back three pages. If we use history.goto(2) then it will forward two pages. The mostly used method is back().
    0 0

    Abadit  

    answered 3 years ago

      More

      More

         
         

        Ask a Question via Twitter

        Send a question to @askblurtit and we will publish it online and send you a reply everytime you receive an answer.

        Blurtit Store

        Get T-shirts, hoodies, caps and more at the Blurtit store

        Blurtit International