识别不同站点上的用户

时间:2013-10-22 08:07:36

标签: javascript

您知道如何使用JS帮助为不同的网站设置用户的公共ID? 我需要这样才能识别不同网站上的用户。 您如何看待使用localstorage? 感谢

3 个答案:

答案 0 :(得分:1)

如果您的用户使用较旧的浏览器(kuch IE),Localstorage还不可靠。

你可以做到这一点的最好方法是在他们的计算机上记录一个包含所需登录详细信息的cookie(加密的源代码),然后基本上在每个网站上根据cookie自动登录它们。

Here is a w3schools link about javascript cookies.

我建议您查看此问题,因为此问题已标记为JavaScript。

修改

作为对下面绝对正确评论的回复,这里是PHP cookies手册的链接,如果你想在多个网站上识别用户,PHP很可能会处理这个,因为它无法被禁用。

here is the link to the php.net setcookie manual

如果您需要了解PHP,php.net是PHP函数文档的一个很好的资源(可能是最好的)。

答案 1 :(得分:0)

看看这个网站:

http://www.w3schools.com/js/js_cookies.asp

这是关于如何使用JS管理cookie:

A cookie is a variable that is stored on the visitor's computer.
Each time the same computer requests a page with a browser,
it will send the cookie too. With JavaScript, you can both 
create and retrieve cookie values.

答案 2 :(得分:0)

可能使用flash cookies:

Ubiquitous availability (95 percent of visitors will probably have flash)
You can store more data per cookie (up to 100 KB)
Shared across browsers, so more likely to uniquely identify a machine
Clearing the browser cookies does not remove the flash cookies.

你需要制作一个小的(隐藏的)flash电影来读写它们。

无论您选择哪条路线,请确保您的用户选择加入跟踪,否则您将侵犯他们的隐私并成为其中一个坏人。