SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Guru dale_burrell's Avatar
    Join Date
    Aug 2002
    Location
    Wellington, New Zealand
    Posts
    861
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    document.location.href or document.URL

    Which is the better option to use when dynamically loading a page?

    document.location.href = "newpage.html"

    or

    document.URL = "newpage.html"

    My book says that Netscape depreciated document.location.href in favour of document.URL, but yahoo are using document.location.href.

    Also, is there a good online reference (up-to-date) of the DOM which includes stuff like this?
    If you aren't living life on the edge
    - you're taking up too much space
    Creative Dreaming Ltd / Ask The Local / Amanzi Travel

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)

    Re: document.location.href or document.URL

    Originally posted by dale_burrell
    Which is the better option to use when dynamically loading a page?

    document.location.href = "newpage.html"

    or

    document.URL = "newpage.html"

    My book says that Netscape depreciated document.location.href in favour of document.URL, but yahoo are using document.location.href.

    Also, is there a good online reference (up-to-date) of the DOM which includes stuff like this?
    It actually should be "window.location.href" or just "location.href" (the window object is always implied). You may have an old book, as "document.URL" was the one that has been deprecated.

    --Vinnie

  3. #3
    SitePoint Guru dale_burrell's Avatar
    Join Date
    Aug 2002
    Location
    Wellington, New Zealand
    Posts
    861
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you recommend somewhere online to obtain this kind of info?
    If you aren't living life on the edge
    - you're taking up too much space
    Creative Dreaming Ltd / Ask The Local / Amanzi Travel

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    http://www.w3.org/DOM/

    Everything you need to know, and probably a lot that you don't. The W3C is VERY thorough on their specs.

    --Vinnie

  5. #5
    SitePoint Guru dale_burrell's Avatar
    Join Date
    Aug 2002
    Location
    Wellington, New Zealand
    Posts
    861
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ar yes, the spec, know about that. Found it a bit hard to understand.

    Anything simplier around?

    Actually AFAICS the spec says that an HTMLDocument has a URL attribute not a location attribute?
    Last edited by dale_burrell; Dec 19, 2002 at 03:57.
    If you aren't living life on the edge
    - you're taking up too much space
    Creative Dreaming Ltd / Ask The Local / Amanzi Travel

  6. #6
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Originally posted by dale_burrell
    Ar yes, the spec, know about that. Found it a bit hard to understand.

    Anything simplier around?

    Actually AFAICS the spec says that an HTMLDocument has a URL attribute not a location attribute?
    location is a property of the window object, which is why you don't see it in the HTMLDocument spec.

    --Vinnie

  7. #7
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    You may also want to check out Netscape's developer site. I can't remember the exact URL now but it contains a lot of info on Javascript and the DOM.

    --Vinnie


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •