need back script for safari

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

    need back script for safari

    i'm looking for a back script that will work in Safari (on mac).
    the one below works fine in IE and netscape but not safari.

    <a href="#" onClick="histor y.go(-1)">go back</a>

    any help plz?
  • max power

    #2
    Re: need back script for safari

    In article
    <none-010604170338000 1@c211-28-190-157.mckinn1.vic .optusnet.com.a u>,
    woodsie <none@none.co m> wrote:
    [color=blue]
    > i'm looking for a back script that will work in Safari (on mac).
    > the one below works fine in IE and netscape but not safari.
    >
    > <a href="#" onClick="histor y.go(-1)">go back</a>
    >
    > any help plz?[/color]

    use history.back() instead of history.go(-1)

    Comment

    • dBrippel

      #3
      Re: need back script for safari

      woodsie wrote:[color=blue]
      > *i'm looking for a back script that will work in Safari (on mac).
      > the one below works fine in IE and netscape but not safari.
      >
      > <a href="#" onClick="histor y.go(-1)">go back</a>
      >
      > any help plz? *[/color]

      You can use history.go(-1), but don't use the "#" and the "onClick
      command:

      <a href="javascrip t:history.go(-1)">go back</a>

      This works in Safari
      -
      dBrippe

      Comment

      • Lasse Reichstein Nielsen

        #4
        Re: need back script for safari

        dBrippel <dBrippel.18rby r@mail.forum4de signers.com> writes:
        [color=blue]
        > woodsie wrote:[color=green]
        >> <a href="#" onClick="histor y.go(-1)">go back</a>[/color][/color]
        ....[color=blue]
        > You can use history.go(-1), but don't use the "#" and the "onClick"
        > command:
        >
        > <a href="javascrip t:history.go(-1)">go back</a>[/color]

        I disagree. You only need to use "javascript :" when you are creating
        bookmarklets. In all other cases, you should use onclick instead.
        <URL: http://jibbering.com/faq/#FAQ4_24 >

        I don't know what the problem with Safari is, but I won't believe
        that it's onclick handlers not working. Try:
        <a href="..." onClick="histor y.go(-1);return false;">go back</a>

        Now, the big question is what to write instead of "...".

        I agree that "#" and "" are not good solutions (both link back to
        the same page, which is not a good behavior for a link that says
        "go back").

        Since the href is only used if Javascript fails, you cannot use
        Javascript to fill it out.
        Either 1) use server side scripting to make it link to the previous
        page based on the referrer header, if present, 2) make it link to
        a plausible previosu page, or 3) make it link to a page that tells
        the user that he needs Javascript.

        A different solution is to only include the link if Javascript is
        enabled, either by creating it using Javascript, or by hiding it
        using CSS and unhide it using Javascript.


        Anyway, I think it is a bad idea to reimplement basic browser
        interface functions. There is already a back button, and it works
        100% of the time.

        /L
        --
        Lasse Reichstein Nielsen - lrn@hotpop.com
        DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
        'Faith without judgement merely degrades the spirit divine.'

        Comment

        Working...