Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. window.history.go()

window.history.go()

Scheduled Pinned Locked Moved Web Development
javascriptcomtutorial
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    chohanpk
    wrote on last edited by
    #1

    can i use history object like this in javascript window.history.go('http://www.google.com') becoz syntax in tutorial is " The go() method loads a specific page in the history list. Syntax history.go(number|URL) " Chohan

    Chohan

    M 1 Reply Last reply
    0
    • C chohanpk

      can i use history object like this in javascript window.history.go('http://www.google.com') becoz syntax in tutorial is " The go() method loads a specific page in the history list. Syntax history.go(number|URL) " Chohan

      Chohan

      M Offline
      M Offline
      MatrixCoder
      wrote on last edited by
      #2

      You can use both. See here.


      Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

      C 1 Reply Last reply
      0
      • M MatrixCoder

        You can use both. See here.


        Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

        C Offline
        C Offline
        chohanpk
        wrote on last edited by
        #3

        here is my code but only "window.history.go(-1)" works. on onclick event of button. Note:when i posted msg onclick replace with removed.so insted of removed here is onclick in code function gone() { window.history.go(-1) //window.history.go('http://www.google.com') //Go to nearest URL in history list with "javascriptkit.com" in the URL. }

        Chohan

        M 1 Reply Last reply
        0
        • C chohanpk

          here is my code but only "window.history.go(-1)" works. on onclick event of button. Note:when i posted msg onclick replace with removed.so insted of removed here is onclick in code function gone() { window.history.go(-1) //window.history.go('http://www.google.com') //Go to nearest URL in history list with "javascriptkit.com" in the URL. }

          Chohan

          M Offline
          M Offline
          MatrixCoder
          wrote on last edited by
          #4

          Is there more than one page in your history?


          Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

          C 1 Reply Last reply
          0
          • M MatrixCoder

            Is there more than one page in your history?


            Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

            C Offline
            C Offline
            chohanpk
            wrote on last edited by
            #5

            yeah .first i opend google page in browser then my on page.but it didnt open google page again when i click on button

            Chohan

            M 1 Reply Last reply
            0
            • C chohanpk

              yeah .first i opend google page in browser then my on page.but it didnt open google page again when i click on button

              Chohan

              M Offline
              M Offline
              MatrixCoder
              wrote on last edited by
              #6

              Try changing window.history.go(-1) to window.history.go(-2).


              Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

              C 1 Reply Last reply
              0
              • M MatrixCoder

                Try changing window.history.go(-1) to window.history.go(-2).


                Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

                C Offline
                C Offline
                chohanpk
                wrote on last edited by
                #7

                oh no.i dont wana give here number.-2 will also work.but i want to give here any "url".plz see the lines which are in comments in code

                Chohan

                M B 2 Replies Last reply
                0
                • C chohanpk

                  oh no.i dont wana give here number.-2 will also work.but i want to give here any "url".plz see the lines which are in comments in code

                  Chohan

                  M Offline
                  M Offline
                  MatrixCoder
                  wrote on last edited by
                  #8

                  Then you might want to use some thing like this:


                  Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

                  1 Reply Last reply
                  0
                  • C chohanpk

                    oh no.i dont wana give here number.-2 will also work.but i want to give here any "url".plz see the lines which are in comments in code

                    Chohan

                    B Offline
                    B Offline
                    Bradml
                    wrote on last edited by
                    #9

                    How about doing his the normal way and have: document.location = "http://google.com";


                    Brad Australian -CAUTION- The previous statement may contain traces of PHP, and by reading this statement you negate the right to vote me down.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups