Is top.location cross browser?

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

    Is top.location cross browser?

    Assuming JS is enabled, what is the most cross browser for changing the
    location of the page? I am currently use top.location. Works fine in IE 6,
    Firefox 9, Opera 7, but I am not sure about older or other browers, like Mac
    browser.

    this.location
    top.location
    document.locati on
    _top.location


  • Fred Oz

    #2
    Re: Is top.location cross browser?

    nntp wrote:[color=blue]
    > Assuming JS is enabled, what is the most cross browser for changing the
    > location of the page? I am currently use top.location. Works fine in IE 6,
    > Firefox 9, Opera 7, but I am not sure about older or other browers, like Mac
    > browser.
    >
    > this.location
    > top.location
    > document.locati on
    > _top.location
    >
    >[/color]

    The oldest Mac browser I have is IE, I guess I could test NS 4 if I
    could find somewhere to download it from and you're really desperate.

    I tested top.location in the following Mac browsers (listed in
    alphabetical order for no particular reason):

    Camino 0.7
    Firefox 0.9.1
    Internet Explorer 5.2.2
    Mozilla 1.7
    Netscape 7.2
    Omniweb 5.0.1
    Opera 6.03
    Safari 1.0.3

    Cheers, Fred :-)

    Comment

    • nntp

      #3
      Re: Is top.location cross browser?

      > > this.location[color=blue][color=green]
      > > top.location
      > > document.locati on
      > > _top.location
      > >
      > >[/color]
      >
      > The oldest Mac browser I have is IE, I guess I could test NS 4 if I
      > could find somewhere to download it from and you're really desperate.
      >
      > I tested top.location in the following Mac browsers (listed in
      > alphabetical order for no particular reason):
      >
      > Camino 0.7
      > Firefox 0.9.1
      > Internet Explorer 5.2.2
      > Mozilla 1.7
      > Netscape 7.2
      > Omniweb 5.0.1
      > Opera 6.03
      > Safari 1.0.3
      >
      > Cheers, Fred :-)[/color]

      TESTED? Result? All passed?
      I appriciate your time. Thank.


      Comment

      • Fred Oz

        #4
        Re: Is top.location cross browser?

        nntp wrote:
        [color=blue]
        > TESTED? Result? All passed?
        > I appriciate your time. Thank.
        >
        >[/color]

        Sheesh, always with the questions... :-)

        I realise I shoulda added "and they all passed".

        Cheers, Fred.

        Comment

        • VK

          #5
          Re: Is top.location cross browser?

          To address the same page where the script itself resides:
          self.location.h ref = newURL;

          To address another page in a frameset:
          window.top.fram eName.location. href = newURL;
          or (hypercorrect):
          window.top.fram es['frameName'].location.href = newURL;

          top.location addresses the topmost frame, which is semi-OK if there are no
          frames (=self) or if you indeed want to replace the whole frameset with the
          new address.
          Otherwise the results will not be as expected.


          Comment

          Working...