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

Discussion in 'Javascript' started by Peter Bremer, Jul 30, 2003.

  1. Peter Bremer

    Peter Bremer Guest

    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>document.write (window.history.length);</script>

    Mozilla returns the error "window.history 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/dom_window_ref25.html

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

    Thanks, Peter
     
    Peter Bremer, Jul 30, 2003
    #1
    1. Advertising

  2. Peter Bremer

    Peter Bremer Guest

    "rf" <> wrote in message
    news:z2PVa.706$...
    >
    > "Peter Bremer" <-> wrote in message
    > news:3f27bbc9$0$49110$4all.nl...
    > > 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>document.write (window.history.length);</script>
    > >
    > > Mozilla returns the error "window.history 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/dom_window_ref25.html
    > >
    > > Can anybody help me, and tell me how to emulate 'history.back()' without
    > > using the history object?

    >
    > <p>Press your browsers "back" button to return to where you came from</p>
    >
    > Cheers
    > Richard.


    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?
     
    Peter Bremer, Jul 30, 2003
    #2
    1. Advertising

  3. "Vjekoslav Begovic" <> wrote in message
    news:bg8f3t$l67$...
    > Perhaps using document.location and document.refferer properties?



    Sorry, window.location and document.referer, of course.
     
    Vjekoslav Begovic, Jul 30, 2003
    #3
  4. Peter Bremer

    rf Guest

    "Peter Bremer" <-> wrote in message
    news:3f27be62$0$49098$4all.nl...
    >
    > "rf" <> wrote in message
    > news:z2PVa.706$...


    > > > Can anybody help me, and tell me how to emulate 'history.back()'

    without
    > > > using the history object?

    > >
    > > <p>Press your browsers "back" button to return to where you came

    from</p>
    > >
    > > Cheers
    > > Richard.

    >
    > 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?


    You can not.

    Cheers
    Richard.
     
    rf, Jul 30, 2003
    #4
  5. Peter Bremer

    rf Guest

    "rf" <> wrote in message
    news:FpPVa.756$...
    >
    > "Vjekoslav Begovic" <> wrote in message
    > news:bg8f7p$l6s$...
    > > "Vjekoslav Begovic" <> wrote in message
    > > news:bg8f3t$l67$...
    > > > Perhaps using document.location and document.refferer properties?

    > >
    > >
    > > Sorry, window.location and document.referer, of course.

    >
    > And where precicely is document.referer defined client side?


    Belay that. You are right. Document.referer 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.
     
    rf, Jul 30, 2003
    #5
  6. Peter Bremer

    Peter Bremer Guest

    "Jacqui or (maybe) Pete" <> wrote in message
    news:...
    > In article <3f27be62$0$49098$4all.nl>, "Peter Bremer"
    > <-> says...
    > >
    > > "rf" <> wrote in message
    > > news:z2PVa.706$...
    > > >
    > > > "Peter Bremer" <-> wrote in message
    > > > news:3f27bbc9$0$49110$4all.nl...

    > ...
    > > > <p>Press your browsers "back" button to return to where you came

    from</p>
    > > >

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

    object?
    > >

    > 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


    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'...
     
    Peter Bremer, Jul 30, 2003
    #6
  7. "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 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>document.write (window.history.length);</script>
    >
    > Mozilla returns the error "window.history 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 -
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, Jul 30, 2003
    #7
  8. Peter Bremer

    Peter Bremer Guest

    "Lasse Reichstein Nielsen" <> wrote in message
    news:...
    > "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 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>document.write (window.history.length);</script>
    > >
    > > Mozilla returns the error "window.history 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 -
    > Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
    > 'Faith without judgement merely degrades the spirit divine.'


    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...
     
    Peter Bremer, Jul 30, 2003
    #8
  9. Peter Bremer

    Peter Bremer Guest

    "Peter Bremer" <-> wrote in message
    news:3f27c5ea$0$49110$4all.nl...
    >
    > "Lasse Reichstein Nielsen" <> wrote in message
    > news:...
    > > "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

    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>document.write (window.history.length);</script>
    > > >
    > > > Mozilla returns the error "window.history 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 -
    > > Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
    > > 'Faith without judgement merely degrades the spirit divine.'

    >
    > 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...


    Okay, the problem is not there in Firebird v.0.6.1, so maybe it is a
    Mozilla-specific problem?
     
    Peter Bremer, Jul 30, 2003
    #9
  10. In article <3f27c468$0$49099$4all.nl>, "Peter Bremer"
    <-> says...
    >
    > "Jacqui or (maybe) Pete" <> wrote in message
    > news:...
    > > In article <3f27be62$0$49098$4all.nl>, "Peter Bremer"
    > > <-> says...
    > > >
    > > > "rf" <> wrote in message
    > > > news:z2PVa.706$...
    > > > >
    > > > > "Peter Bremer" <-> wrote in message
    > > > > news:3f27bbc9$0$49110$4all.nl...

    > > ...
    > > > > <p>Press your browsers "back" button to return to where you came

    > from</p>
    > > > >

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

    > object?
    > > >

    ....
    > > http://www.foad.org/~abigail/HTML/Misc/back_button.html

    >
    > 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.

    ....
    The source I pointed you to uses 'history.back()' and works fine in
    Mozilla 1.5b.
     
    Jacqui or (maybe) Pete, Jul 30, 2003
    #10
  11. Peter Bremer

    Peter Bremer Guest

    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...
     
    Peter Bremer, Jul 30, 2003
    #11
  12. In article <3f27d00f$0$49102$4all.nl>, "Peter Bremer"
    <-> says...
    > 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...
    >

    Bloody javascript debugger seems to be broken in that version,
    though :0(
     
    Jacqui or (maybe) Pete, Jul 30, 2003
    #12
  13. While the city slept, Peter Bremer <-> feverishly typed:

    [...]
    > 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.


    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.html">Previous</a> | <a
    href="stage3.html">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. . Take the dog out!
    http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
    "How strange the change from major to minor..."
     
    nice.guy.nige, Jul 30, 2003
    #13
  14. Peter Bremer

    Grant Wagner Guest

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

    Peter Bremer wrote:

    > "Peter Bremer" <-> wrote in message
    > news:3f27c5ea$0$49110$4all.nl...
    > >
    > > "Lasse Reichstein Nielsen" <> wrote in message
    > > news:...
    > > > "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

    > 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>document.write (window.history.length);</script>
    > > > >
    > > > > Mozilla returns the error "window.history 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 -
    > > > Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
    > > > 'Faith without judgement merely degrades the spirit divine.'

    > >
    > > 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...

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


    <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN'
    'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>
    <script>document.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 <>

    * Client-side Javascript and Netscape 4 DOM Reference available at:
    *
    http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

    * Internet Explorer DOM Reference available at:
    *
    http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

    * 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-developer/upgrade_2.html
     
    Grant Wagner, Jul 30, 2003
    #14
  15. Re: Javascript 'history' object unavailable in Mozilla/Gecko/Netscape in strict mode??

    Grant Wagner <> writes:

    > 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.


    Try putting the code into an HTML file. Then open Mozilla 1.5a and drag
    the file onto the browser. Then do it again. That reproduces the error
    for me every time.

    /L
    --
    Lasse Reichstein Nielsen -
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, Jul 30, 2003
    #15
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Bremer
    Replies:
    11
    Views:
    847
    nice.guy.nige
    Jul 30, 2003
  2. tshad
    Replies:
    13
    Views:
    924
    Mark Parnell
    Mar 23, 2005
  3. ree321
    Replies:
    3
    Views:
    517
    Patrice
    Oct 12, 2007
  4. Sam Stephenson
    Replies:
    1
    Views:
    238
    Andrew Walrond
    Jun 18, 2005
  5. philippe
    Replies:
    0
    Views:
    253
    philippe
    Dec 12, 2006
Loading...

Share This Page