Web Analytics Made Easy -
StatCounter Is there a way to generate info from the Address Bar? - CodingForum

Announcement

Collapse
No announcement yet.

Is there a way to generate info from the Address Bar?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is there a way to generate info from the Address Bar?

    For a web page I'm making, I need to be able to generate the browser's www. address into a page's content.

    For example;
    Content on page reads:

    www.newdomain.com has been resistered with us for one of our
    clients.

    www.newdomain.com - should be generated from the address bar URL.
    Is it possible to do this?

    cheers

  • #2
    Code:
    var w = window.location.href 
    alert(w);
    USA

    Comment


    • #3
      If you want the whole address printed out:

      document.write(window.location.href);

      If you only want the domain written out (i.e. www.codingforum.net regardless of where you are on the site):

      document.write(document.domain);

      jasonkarldavis.com

      Comment


      • #4
        Thanks a lot guys! I think, document.write(window.location.href); Is just what I need! I'd better go test it first

        Comment

        Working...
        X