du4010 2011-08-03 20:48
浏览 33

将Evercookie值传递出函数

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 + "
" +
        "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", getCookie);
  • 写回答

1条回答 默认 最新

  • dsxay48646 2011-08-04 00:39
    关注

    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; }); 
    
    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)