Weinre在iOS 7上不工作的原因
升级到iOS 7 后发现Weinre不能工作了,通过Safari调试发现报错如下:
[Error] SecurityError: DOM Exception 18: An attempt was made to break through the security policy of the user agent. (匿名函数) (target-script-min.js, line 2114) require (target-script-min.js, line 73) (匿名函数) (target-script-min.js, line 2823) require (target-script-min.js, line 73) (匿名函数) (target-script-min.js, line 3336) require (target-script-min.js, line 73) (匿名函数) (target-script-min.js, line 4702)
通过搜索发现,是因为iOS 7默认阻止所有Cookie,导致访问localStorage时报错。在Safari设置里面修改接受Cookie即可正常使用Weinre。
相关文章:
http://www.facebook.com/note.php?note_id=10150644536327287
http://www.extremetech.com/mobile/166941-6-tips-and-tricks-for-ios-7
http://www.blogosfera.co.uk/2013/09/ios7-unable-to-access-html5-localstorage-if-cookies-is-disabled/
http://spin.atomicobject.com/2013/01/23/ios-private-browsing-localstorage/