【发布时间】:2017-11-27 16:25:54
【问题描述】:
JavaScript 代码
$cookies.put('test', 'test_value');
console.log('cookie value: ' + $cookies.get('test'));
我直接双击html文件通过file:///C:/Users/xxxxx/test.html访问,却发现无法写入或读取cookie:
cookie 值:未定义
如果我把html文件放到Nginx的'HTML'文件夹中,通过http://127.0.0.1/test.html访问,就可以正常读取cookie了:
cookie 值:test_value
我不知道为什么,想知道一个解释。谢谢。
【问题讨论】:
-
您使用的 angular-cookie 版本是什么..?
-
@undefined 1.6.4
标签: javascript html angularjs cookies