Javascript 'history' object unavailable in Mozilla/Gecko/Netscape in strict mode??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Bremer

    Javascript 'history' object unavailable in Mozilla/Gecko/Netscape in strict mode??

    Hi all,

    I've written this little piece of code, which doesn't seem to work in
    Mozilla 1.5. I haven't tried it on other Gecko browsers, but I've found
    some indication that Netscape 6+ has the same problem. Internet Explorer 6
    and Opera 7 have no problems with it.

    <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN'
    'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>
    <script>documen t.write (window.history .length);</script>

    Mozilla returns the error "window.his tory has no properties".
    Extensive searching on internet gave no help, even Mozilla's own DOM
    Reference says nothing about it:


    Can anybody help me, and tell me how to emulate 'history.back() ' without
    using the history object?

    Thanks, Peter


  • Peter Bremer

    #2
    Re: Javascript 'history' object unavailable in Mozilla/Gecko/Netscape in strict mode??


    "rf" <making.it.up@t he.time> wrote in message
    news:z2PVa.706$ bo1.105@news-server.bigpond. net.au...[color=blue]
    >
    > "Peter Bremer" <-> wrote in message
    > news:3f27bbc9$0 $49110$e4fe514c @news.xs4all.nl ...[color=green]
    > > Hi all,
    > >
    > > I've written this little piece of code, which doesn't seem to work in
    > > Mozilla 1.5. I haven't tried it on other Gecko browsers, but I've found
    > > some indication that Netscape 6+ has the same problem. Internet[/color][/color]
    Explorer[color=blue]
    > 6[color=green]
    > > and Opera 7 have no problems with it.
    > >
    > > <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN'
    > > 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>
    > > <script>documen t.write (window.history .length);</script>
    > >
    > > Mozilla returns the error "window.his tory has no properties".
    > > Extensive searching on internet gave no help, even Mozilla's own DOM
    > > Reference says nothing about it:
    > > http://mozilla.org/docs/dom/domref/d...dow_ref25.html
    > >
    > > Can anybody help me, and tell me how to emulate 'history.back() ' without
    > > using the history object?[/color]
    >
    > <p>Press your browsers "back" button to return to where you came from</p>
    >
    > Cheers
    > Richard.[/color]

    Hehehehe.... funnyyyyy... :-)
    Okay, let me rephrase: Can anybody help me, and tell me how to emulate
    'history.back() ' USING JAVASCRIPT CODE, without using the history object?


    Comment

    • brucie

      #3
      Re: Javascript 'history' object unavailable in Mozilla/Gecko/Netscape in strict mode??

      In post <3f27bbc9$0$491 10$e4fe514c@new s.xs4all.nl>
      Peter Bremer said...
      [color=blue]
      > Can anybody help me, and tell me how to emulate 'history.back() ' without
      > using the history object?[/color]

      every browser i've ever seen already has the ability to return to the
      previous resource built in and it works which is a good thing
      considering its the most used function after the humble little link.

      you are trying to re-invent the wheel and it will be at best square.
      you are wasting your time.

      --
      brucie a. blackford. 30/July/2003 10:51:34 pm kilo.

      Comment

      • Vjekoslav Begovic

        #4
        Re: Javascript 'history' object unavailable in Mozilla/Gecko/Netscape in strict mode??

        "Vjekoslav Begovic" <vjbegovic@inet .hr> wrote in message
        news:bg8f3t$l67 $1@sunce.iskon. hr...[color=blue]
        > Perhaps using document.locati on and document.reffer er properties?[/color]


        Sorry, window.location and document.refere r, of course.


        Comment

        • rf

          #5
          Re: Javascript 'history' object unavailable in Mozilla/Gecko/Netscape in strict mode??


          "Peter Bremer" <-> wrote in message
          news:3f27be62$0 $49098$e4fe514c @news.xs4all.nl ...[color=blue]
          >
          > "rf" <making.it.up@t he.time> wrote in message
          > news:z2PVa.706$ bo1.105@news-server.bigpond. net.au...[/color]
          [color=blue][color=green][color=darkred]
          > > > Can anybody help me, and tell me how to emulate 'history.back() '[/color][/color][/color]
          without[color=blue][color=green][color=darkred]
          > > > using the history object?[/color]
          > >
          > > <p>Press your browsers "back" button to return to where you came[/color][/color]
          from</p>[color=blue][color=green]
          > >
          > > Cheers
          > > Richard.[/color]
          >
          > Hehehehe.... funnyyyyy... :-)
          > Okay, let me rephrase: Can anybody help me, and tell me how to emulate
          > 'history.back() ' USING JAVASCRIPT CODE, without using the history object?[/color]

          You can not.

          Cheers
          Richard.


          Comment

          • Lasse Reichstein Nielsen

            #6
            Re: Javascript 'history' object unavailable in Mozilla/Gecko/Netscape in strict mode??

            "Peter Bremer" <-> writes:
            [color=blue]
            > I've written this little piece of code, which doesn't seem to work in
            > Mozilla 1.5. I haven't tried it on other Gecko browsers, but I've found
            > some indication that Netscape 6+ has the same problem. Internet Explorer 6
            > and Opera 7 have no problems with it.
            >
            > <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN'
            > 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>
            > <script>documen t.write (window.history .length);</script>
            >
            > Mozilla returns the error "window.his tory has no properties".[/color]

            My Mozilla Firebird v0.6 has no problems with it.
            Can you show a live page where it fails?

            /L
            --
            Lasse Reichstein Nielsen - lrn@hotpop.com
            Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
            'Faith without judgement merely degrades the spirit divine.'

            Comment

            • Peter Bremer

              #7
              Re: Javascript 'history' object unavailable in Mozilla/Gecko/Netscape in strict mode??


              "Jacqui or (maybe) Pete" <porjes@spamcop .net> wrote in message
              news:MPG.1991d0 c4b62f9592989cb 8@news.CIS.DFN. DE...[color=blue]
              > In article <3f27be62$0$490 98$e4fe514c@new s.xs4all.nl>, "Peter Bremer"
              > <-> says...[color=green]
              > >
              > > "rf" <making.it.up@t he.time> wrote in message
              > > news:z2PVa.706$ bo1.105@news-server.bigpond. net.au...[color=darkred]
              > > >
              > > > "Peter Bremer" <-> wrote in message
              > > > news:3f27bbc9$0 $49110$e4fe514c @news.xs4all.nl ...[/color][/color]
              > ...[color=green][color=darkred]
              > > > <p>Press your browsers "back" button to return to where you came[/color][/color][/color]
              from</p>[color=blue][color=green][color=darkred]
              > > >[/color][/color]
              > ...[color=green]
              > > Okay, let me rephrase: Can anybody help me, and tell me how to emulate
              > > 'history.back() ' USING JAVASCRIPT CODE, without using the history[/color][/color]
              object?[color=blue][color=green]
              > >[/color]
              > I suppose you'll want to duplicate the maximize, minimise, print,
              > forward, etc functions of the browser too? Why?
              >
              > Anyway - a javascript 'solution' is given here:
              > http://www.foad.org/~abigail/HTML/Misc/back_button.html[/color]

              I'm sorry Jacqui or (maybe) Pete, I don't know if you have read the message,
              but I discovered that the HISTORY object seems not supported by Gecko in
              strict mode. And that is exactly the object that is used in the 'solution'
              you point me to.
              You are right to argue the use of a history.back() function in JavaScript.
              What I want to do, is create a sort of 'wizard' application, such as you
              commonly see in Windows when going through complex tasks. These
              applications often have a 'next' button, going to the next step, and a
              'previous' button going to the previous step.
              Of course I could create all kinds of complex scripts for the 'previous'
              button, retrieving previously entered information from cookies, session
              variables or database fields, but a simple 'history.back() ' JavaScript
              function also does the trick. That is, on every JavaScript-enabled browser
              except for Gecko in strict mode...
              Now, before resorting to writing complex code for that one set of browsers,
              I was trying to find out if there was another simple way to go 'back in
              history'...


              Comment

              • rf

                #8
                Re: Javascript 'history' object unavailable in Mozilla/Gecko/Netscape in strict mode??


                "rf" <making.it.up@t he.time> wrote in message
                news:FpPVa.756$ bo1.350@news-server.bigpond. net.au...[color=blue]
                >
                > "Vjekoslav Begovic" <vjbegovic@inet .hr> wrote in message
                > news:bg8f7p$l6s $1@sunce.iskon. hr...[color=green]
                > > "Vjekoslav Begovic" <vjbegovic@inet .hr> wrote in message
                > > news:bg8f3t$l67 $1@sunce.iskon. hr...[color=darkred]
                > > > Perhaps using document.locati on and document.reffer er properties?[/color]
                > >
                > >
                > > Sorry, window.location and document.refere r, of course.[/color]
                >
                > And where precicely is document.refere r defined client side?[/color]

                Belay that. You are right. Document.refere r could be refered[sic] to client
                side to insert the relevent link into the document *provided* the browser
                provides said datum in its request for the page.

                Cheers
                Richard.


                Comment

                • Peter Bremer

                  #9
                  Re: Javascript 'history' object unavailable in Mozilla/Gecko/Netscape in strict mode??


                  "Lasse Reichstein Nielsen" <lrn@hotpop.com > wrote in message
                  news:el08gnnw.f sf@hotpop.com.. .[color=blue]
                  > "Peter Bremer" <-> writes:
                  >[color=green]
                  > > I've written this little piece of code, which doesn't seem to work in
                  > > Mozilla 1.5. I haven't tried it on other Gecko browsers, but I've found
                  > > some indication that Netscape 6+ has the same problem. Internet[/color][/color]
                  Explorer 6[color=blue][color=green]
                  > > and Opera 7 have no problems with it.
                  > >
                  > > <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN'
                  > > 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>
                  > > <script>documen t.write (window.history .length);</script>
                  > >
                  > > Mozilla returns the error "window.his tory has no properties".[/color]
                  >
                  > My Mozilla Firebird v0.6 has no problems with it.
                  > Can you show a live page where it fails?
                  >
                  > /L
                  > --
                  > Lasse Reichstein Nielsen - lrn@hotpop.com
                  > Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
                  > 'Faith without judgement merely degrades the spirit divine.'[/color]

                  The code I wrote is enough to duplicate the problem on Mozilla 1.5a. Just
                  copy those 3 lines to an empty HTML file, run it, see the empty results
                  page, and check the JavaScript Console under Tools > Web Development >
                  JavaScript Console...
                  I am now downloading Firebird v0.6.1 to check the problem there...


                  Comment

                  • Peter Bremer

                    #10
                    Re: Javascript 'history' object unavailable in Mozilla/Gecko/Netscape in strict mode??


                    "Peter Bremer" <-> wrote in message
                    news:3f27c5ea$0 $49110$e4fe514c @news.xs4all.nl ...[color=blue]
                    >
                    > "Lasse Reichstein Nielsen" <lrn@hotpop.com > wrote in message
                    > news:el08gnnw.f sf@hotpop.com.. .[color=green]
                    > > "Peter Bremer" <-> writes:
                    > >[color=darkred]
                    > > > I've written this little piece of code, which doesn't seem to work in
                    > > > Mozilla 1.5. I haven't tried it on other Gecko browsers, but I've[/color][/color][/color]
                    found[color=blue][color=green][color=darkred]
                    > > > some indication that Netscape 6+ has the same problem. Internet[/color][/color]
                    > Explorer 6[color=green][color=darkred]
                    > > > and Opera 7 have no problems with it.
                    > > >
                    > > > <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN'
                    > > > 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>
                    > > > <script>documen t.write (window.history .length);</script>
                    > > >
                    > > > Mozilla returns the error "window.his tory has no properties".[/color]
                    > >
                    > > My Mozilla Firebird v0.6 has no problems with it.
                    > > Can you show a live page where it fails?
                    > >
                    > > /L
                    > > --
                    > > Lasse Reichstein Nielsen - lrn@hotpop.com
                    > > Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
                    > > 'Faith without judgement merely degrades the spirit divine.'[/color]
                    >
                    > The code I wrote is enough to duplicate the problem on Mozilla 1.5a. Just
                    > copy those 3 lines to an empty HTML file, run it, see the empty results
                    > page, and check the JavaScript Console under Tools > Web Development >
                    > JavaScript Console...
                    > I am now downloading Firebird v0.6.1 to check the problem there...[/color]

                    Okay, the problem is not there in Firebird v.0.6.1, so maybe it is a
                    Mozilla-specific problem?


                    Comment

                    • Jacqui or (maybe) Pete

                      #11
                      Re: Javascript 'history' object unavailable in Mozilla/Gecko/Netscape in strict mode??

                      In article <3f27c468$0$490 99$e4fe514c@new s.xs4all.nl>, "Peter Bremer"
                      <-> says...[color=blue]
                      >
                      > "Jacqui or (maybe) Pete" <porjes@spamcop .net> wrote in message
                      > news:MPG.1991d0 c4b62f9592989cb 8@news.CIS.DFN. DE...[color=green]
                      > > In article <3f27be62$0$490 98$e4fe514c@new s.xs4all.nl>, "Peter Bremer"
                      > > <-> says...[color=darkred]
                      > > >
                      > > > "rf" <making.it.up@t he.time> wrote in message
                      > > > news:z2PVa.706$ bo1.105@news-server.bigpond. net.au...
                      > > > >
                      > > > > "Peter Bremer" <-> wrote in message
                      > > > > news:3f27bbc9$0 $49110$e4fe514c @news.xs4all.nl ...[/color]
                      > > ...[color=darkred]
                      > > > > <p>Press your browsers "back" button to return to where you came[/color][/color]
                      > from</p>[color=green][color=darkred]
                      > > > >[/color]
                      > > ...[color=darkred]
                      > > > Okay, let me rephrase: Can anybody help me, and tell me how to emulate
                      > > > 'history.back() ' USING JAVASCRIPT CODE, without using the history[/color][/color]
                      > object?[color=green][color=darkred]
                      > > >[/color][/color][/color]
                      ....[color=blue][color=green]
                      > > http://www.foad.org/~abigail/HTML/Misc/back_button.html[/color]
                      >
                      > I'm sorry Jacqui or (maybe) Pete, I don't know if you have read the message,
                      > but I discovered that the HISTORY object seems not supported by Gecko in
                      > strict mode. And that is exactly the object that is used in the 'solution'
                      > you point me to.[/color]
                      ....
                      The source I pointed you to uses 'history.back() ' and works fine in
                      Mozilla 1.5b.

                      Comment

                      • Peter Bremer

                        #12
                        Re: Javascript 'history' object unavailable in Mozilla/Gecko/Netscape in strict mode??

                        Okay everybody, thanks for your support! I've found the solution to my
                        problem...
                        It seems that this is indeed a bug in Mozilla 1.5a. I've just downloaded
                        the newest 'nightly build' (1.5b) and it works there...


                        Comment

                        • Jacqui or (maybe) Pete

                          #13
                          Re: Javascript 'history' object unavailable in Mozilla/Gecko/Netscape in strict mode??

                          In article <3f27d00f$0$491 02$e4fe514c@new s.xs4all.nl>, "Peter Bremer"
                          <-> says...[color=blue]
                          > Okay everybody, thanks for your support! I've found the solution to my
                          > problem...
                          > It seems that this is indeed a bug in Mozilla 1.5a. I've just downloaded
                          > the newest 'nightly build' (1.5b) and it works there...
                          >[/color]
                          Bloody javascript debugger seems to be broken in that version,
                          though :0(

                          Comment

                          • nice.guy.nige

                            #14
                            Re: Javascript 'history' object unavailable in Mozilla/Gecko/Netscape in strict mode??

                            While the city slept, Peter Bremer <-> feverishly typed:

                            [...][color=blue]
                            > You are right to argue the use of a history.back() function in
                            > JavaScript. What I want to do, is create a sort of 'wizard'
                            > application, such as you commonly see in Windows when going through
                            > complex tasks. These applications often have a 'next' button, going
                            > to the next step, and a 'previous' button going to the previous step.[/color]

                            Now... I assume you know the URI that the 'next' button is going to take the
                            user to, and that will have to be coded into each page. You say this is a
                            wizard style thing, so I'm also going to assume it is a sequential affair -
                            stage 1 -> stage 2 -> stage 3 -> finished - that kind of thing... does it
                            not follow that you should know where the user came from, and can then code
                            that URI into the 'previous' button. Eg. You are at stage 2 of the wizard.
                            <p><a href="stage1.ht ml">Previous</a> | <a
                            href="stage3.ht ml">Next</a></p>... that sort of thing...

                            Just a thought... feel free to tell me if I am barking up the wrong tree!

                            Cheers,
                            Nige

                            --
                            Nigel Moss.

                            Email address is not valid. nigel@nigenetDO G.org.uk. Take the dog out!
                            http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
                            "How strange the change from major to minor..."


                            Comment

                            • Grant Wagner

                              #15
                              Re: Javascript 'history' object unavailable in Mozilla/Gecko/Netscape instrict mode??

                              Peter Bremer wrote:
                              [color=blue]
                              > "Peter Bremer" <-> wrote in message
                              > news:3f27c5ea$0 $49110$e4fe514c @news.xs4all.nl ...[color=green]
                              > >
                              > > "Lasse Reichstein Nielsen" <lrn@hotpop.com > wrote in message
                              > > news:el08gnnw.f sf@hotpop.com.. .[color=darkred]
                              > > > "Peter Bremer" <-> writes:
                              > > >
                              > > > > I've written this little piece of code, which doesn't seem to work in
                              > > > > Mozilla 1.5. I haven't tried it on other Gecko browsers, but I've[/color][/color]
                              > found[color=green][color=darkred]
                              > > > > some indication that Netscape 6+ has the same problem. Internet[/color]
                              > > Explorer 6[color=darkred]
                              > > > > and Opera 7 have no problems with it.
                              > > > >
                              > > > > <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN'
                              > > > > 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>
                              > > > > <script>documen t.write (window.history .length);</script>
                              > > > >
                              > > > > Mozilla returns the error "window.his tory has no properties".
                              > > >
                              > > > My Mozilla Firebird v0.6 has no problems with it.
                              > > > Can you show a live page where it fails?
                              > > >
                              > > > /L
                              > > > --
                              > > > Lasse Reichstein Nielsen - lrn@hotpop.com
                              > > > Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
                              > > > 'Faith without judgement merely degrades the spirit divine.'[/color]
                              > >
                              > > The code I wrote is enough to duplicate the problem on Mozilla 1.5a. Just
                              > > copy those 3 lines to an empty HTML file, run it, see the empty results
                              > > page, and check the JavaScript Console under Tools > Web Development >
                              > > JavaScript Console...
                              > > I am now downloading Firebird v0.6.1 to check the problem there...[/color]
                              >
                              > Okay, the problem is not there in Firebird v.0.6.1, so maybe it is a
                              > Mozilla-specific problem?[/color]

                              <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN'
                              'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>
                              <script>documen t.write (window.history .length);</script>

                              Works in Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5b) Gecko/20030730

                              Works in Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5b) Gecko/20030729

                              Works in Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5a) Gecko/20030718

                              Works in Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624

                              Works in Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3.1)
                              Gecko/20030425

                              If it's not working in one of the above versions for you, perhaps your Mozilla
                              installation is broken. There may also be bugs on a different platform which are
                              not appearing on Windows.

                              --
                              | Grant Wagner <gwagner@agrico reunited.com>

                              * Client-side Javascript and Netscape 4 DOM Reference available at:
                              *


                              * Internet Explorer DOM Reference available at:
                              *
                              Find official documentation, practical know-how, and expert guidance for builders working and troubleshooting in Microsoft products.


                              * Netscape 6/7 DOM Reference available at:
                              * http://www.mozilla.org/docs/dom/domref/
                              * Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
                              * http://www.mozilla.org/docs/web-deve...upgrade_2.html


                              Comment

                              Working...