evercookie 使用方法示例
2017-08-25 17:23
260 查看
<script type="text/javascript" src="jquery-1.4.2.min.js"></script> <script type="text/javascript" src="swfobject-2.2.min.js"></script> <script type="text/javascript" src="evercookie.js"></script> <script> var ec = new evercookie(); // set a cookie "id" to "12345" // usage: ec.set(key, value) ec.set("id", "12345"); // retrieve a cookie called "id" (simply) ec.get("id", function(value) { alert("Cookie value is " + value) }); // or use a more advanced callback function for getting our cookie // the cookie value is the first param // an object containing the different storage methods // and returned cookie values is the second parameter 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", getCookie); // we look for "candidates" based off the number of "cookies" that // come back matching since it's possible for mismatching cookies. // the best candidate is most likely the correct one </script>
相关文章推荐
- window.resizeBy()方法使用示例
- window.scrollBy()方法使用示例
- Javascript中eval函数的使用方法与示例
- Javascript中eval函数的使用方法与示例
- windows.ResizeTo()方法使用示例
- (四)线程--使用线程回调方法(示例下载)
- (四)线程--使用线程回调方法(示例下载)
- window.scrollBy()方法使用示例
- (四)线程--使用线程回调方法(示例下载)
- windows.ResizeTo()方法使用示例
- iTEXT生成PDF文件使用方法 实例 示例 Servlet输出PDF文档方法
- .Net中FckEditor的配置和使用方法(含示例源码)
- AES类使用方法(内函简单示例)
- window.resizeBy()方法使用示例
- SAFEARRAY使用方法示例
- .Net中FckEditor的配置和使用方法(含示例源码)
- window.scrollTo()方法使用示例
- windows.moveBy()函数使用方法示例
- windows.ResizeTo()方法使用示例
- 下面的示例演示如何使用传递到事件处理方法的 GridViewCommandEventArgs 对象确定引发事件的按钮的命令名。