Passing Evercookie values out of the function
I'm totally stuck trying to get the best evercookie value out of the retrieval function and into a JS or PHP function I can use.
The code below works to trigger the alert for best_candidate, but I can't figure out how to return the value out of the function (I'm guessing the nested functions are what are tripping me up) so I can use the value outside the ec.get() function.
Any help would be greatly appreciated. Thanks!
function getCookie(best_candidate, all_candidates)
{
alert("The retrieved cookie is: " + best_candidate + "\n" +
"You can see what each storage mechanism returned " +
"by looping through the all_candidates object.");
for (var item in all_candidates)
{
document.write("Storage mechanism " + item +
" returned: " + all_candidates[item] + "<br>");
}
}
ec.get("id", getCoo开发者_JS百科kie);
This callback function with many parameters is designed for more specific needs.
All You need is:
var cookie;
ec.get("id", function(value) { cookie = value; });
精彩评论