1

我按照链接作为

https://github.com/truongsinh/node-evercookie

首先在config/http.js中创建了一个用于连接的中间件

然后点击链接:

http://samy.pl/evercookie/

结果在 chrome 控制台中:

Storage mechanism userData returned: undefined<br>
Storage mechanism cookieData returned: undefined<br>
Storage mechanism localData returned: 12345<br>
Storage mechanism globalData returned: undefined<br>
Storage mechanism sessionData returned: 12345<br>
Storage mechanism windowData returned: 12345<br>
Storage mechanism historyData returned: undefined<br>
Storage mechanism pngData returned: undefined<br>
Storage mechanism etagData returned: <br>
Storage mechanism cacheData returned: <br>
Storage mechanism dbData returned: 12345<br>
Storage mechanism lsoData returned: undefined<br>
Storage mechanism slData returned: undefined<br>

在前端 Java 脚本中,它在我设置的警报中给出了正确的 id。

在服务器端:我得到 cookieValue= undefined

Kindle帮助我这是正确的方式还是我在两者之间遗漏了任何东西。

4

1 回答 1

1

我尝试了很多然后使用网站“ http://samy.pl/evercookie/ ”本身的evercookie.js 文件。

然后在 http 中间件中进行更改,如下所示:

var evercookie = require('evercookie');
    var cookieParser = require('cookie-parser');
    app.use(cookieParser());
    app.use(evercookie.backend());
    app.use(cookieParser());
    app.use(require('connect').static(__dirname +'../public')); // be careful, you may want to use path.join instead!
    app.use(evercookie.backend({
      pngCookieName: 'evercookie_png',
      etagCookieName: 'evercookie_etag',
      cacheCookieName: 'evercookie_cache',
      pngPath: '/path/evercookie_png.php',
      etagPath: '/path/evercookie_etag.php',
      cachePath: '/path/evercookie_cache.php'
    }));

注意:“路径”是调用 ec.set 和 ec.get 方法的位置。现在我可以获取 etagData、cacheData 和 cacheData 的 cookie 数据。

于 2016-07-07T10:39:35.367 回答