use js to store current domain, full url, and ip

1

Im trying to obtain the IP address of the user, current domain, and full page URL when my javascript is run ( for traffic analysis )

  var ip = '<!--#echo var="REMOTE_ADDR"-->';
  var domain = document.domain;
  var page = window.location;

I keep getting errors in FF3

Error: uncaught exception: [Exception... "Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIDOMLocation.host]"  nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)"  location: "JS frame :: http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js :: anonymous :: line 12"  data: no]

Any ideas?

javascript
asked on Stack Overflow Nov 16, 2009 by mrpatg

2 Answers

2

That error is within jQuery - seems unrelated to the code you've pasted.

Edit: it looks like you can't window.location (or page) to an AJAX function - you need to use String (location.href) or String(page) or jQuery... could that be it?

answered on Stack Overflow Nov 16, 2009 by Greg
1

I tried the code and works perfectly for me (the newest version of FF - 3.5.5).

Your error message points to http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js, so I think it's related to jQuery.

answered on Stack Overflow Nov 16, 2009 by Ondrej Slinták

User contributions licensed under CC BY-SA 3.0