reffer

Discussion in 'Javascript' started by Alain Dhaene, Apr 13, 2004.

  1. Alain Dhaene

    Alain Dhaene Guest

    HI,

    Is it possible to get the name of the current page in a browser?

    Alain
     
    Alain Dhaene, Apr 13, 2004
    #1
    1. Advertising

  2. Alain Dhaene

    L-and-F Guest

    It depends on what you mean by the name, but this script will give you the
    full path and URL





    <html>
    <!-- www.lee-mcgeorge.co.uk-->
    <head>

    </head>
    <body>

    <SCRIPT LANGUAGE="JavaScript">
    var path = "";
    var href = document.location.href;
    var s = href.split("/");
    for (var i=2;i<(s.length-1);i++) {
    path+="<A
    HREF=\""+href.substring(0,href.indexOf("/"+s)+s.length+1)+"/\">"+s+
    "</A> / ";
    }
    i=s.length-1;
    path+="<A
    HREF=\""+href.substring(0,href.indexOf(s)+s.length)+"\">"+s+"</A>";
    var url = window.location.protocol + "//" + path;
    document.writeln(url);
    </script>

    </body>
    </html>






    "Alain Dhaene" <> wrote in message
    news:c5h0c7$pom$...
    > HI,
    >
    > Is it possible to get the name of the current page in a browser?
    >
    > Alain
    >
    >
     
    L-and-F, Apr 13, 2004
    #2
    1. Advertising

  3. Alain Dhaene wrote:
    > Is it possible to get the name of the current page in a browser?


    Yes, look at the properties of the - location - object.

    Richard.
     
    Richard Cornford, Apr 13, 2004
    #3
  4. Alain Dhaene

    G Roydor Guest

    les propriétés de location sont

    location.[ hash | host | hostname | href | pathname | port | protocol |
    search ]

    GR

    Alain Dhaene a écrit:
    > HI,
    >
    > Is it possible to get the name of the current page in a browser?
    >
    > Alain
    >
    >
     
    G Roydor, Apr 14, 2004
    #4
    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.

Share This Page