我需要帮助解决此Google Chrome错误...“未捕获错误:SECURITY_ERR:DOM异常18”
这是代码。
//Get Cookie
function get_cookie (cookie_name)
{
var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
if (results)
return ( unescape ( results[2] ) );
else
return null;
};
非常感谢, ç
答案 0 :(得分:0)
请参考Uncaught Error: SECURITY_ERR: DOM Exception 18 when I try to set a cookie,@ CResults可能是对的,您在测试中使用了file://而不是http://。
答案 1 :(得分:0)
escape() 函数在 JavaScript 1.5 版中已弃用。
使用 encodeURI() 或 encodeURIComponent() 代替。