开发者

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

开发者 https://www.devze.com 2022-12-11 07:26 出处:网络
Im trying to obtain the IP address of the user, current domain, and full page URL when my javascript is run ( for traffic analysis )

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?


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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消