Menu

#87 document.location prints as object reference instead of URL

closed
None
5
2014-08-14
2003-05-24
No

In JavaScript, the document.location property should
convert to a string as the full URL. However, it converts
to a string as a Java object reference (class name and
hexadecimal ID).

As a reference, see this Gecko manual page:

http://www.mozilla.org/docs/dom/domref/dom_doc_ref26.
html#1025116

Here's a test case:

test.html

<html>
<body>
<script type='text/javascript'>
alert('document.location');
</script>
</body>
</html>

The alert should have the URL (ending in test.html)
instead of a Java object reference.

Discussion

  • David K. Taylor

    David K. Taylor - 2003-05-24
     
  • David K. Taylor

    David K. Taylor - 2003-05-24

    Logged In: YES
    user_id=742109

    Attached is a fix for this problem.

    The fix is to add a toString() method to Location that returns
    the value of the href property.

    The fix also add a test case and adds missing comments for
    earlier test cases I added.

     
  • Mike Bowler

    Mike Bowler - 2003-05-26

    Logged In: YES
    user_id=46756

    Patch committed - thanks

     

Log in to post a comment.