13

Running Safari on iOS 5.1 (iPad), my JavaScript code is throwing the following exception:

SECURITY_ERR: Dom Exception 18: An attempt was made to break through the security policy of the user agent

...whenever I make a call to document.cookie

Now this is a remotely hosted website accessed via a proper URL. All desktop browsers run fine, this only affects Safari on my iPad. I tried to Google the error, but I'm just getting references to calling local files (file://) which I'm not doing as it's a remote website.

Any ideas?

4

1 回答 1

1
  1. 启用 cookie?可能是 cookie 被阻止了。
  2. 协议不匹配?例如 https 页面中的 Http 脚本。
  3. 到大饼干大小?
  4. cookie 值中的非法字符?
  5. 你在使用 iOS UIWebView 吗?它可以是非 uri 方案协议(又名 file://)
  6. 您是否尝试从 iframe 获取 cookie?

检查所有这些,有时它像魔术一样奇怪。

于 2013-11-06T10:30:51.723 回答