admin管理员组文章数量:1414621
In Firefox it's possible using the following...
HTMLDocument.prototype.__defineGetter__("cookie",function (){return "foo=bar";});
HTMLDocument.prototype.__defineSetter__("cookie",function (){});
This doesn't cause any errors in WebKit, and WebKit definitely supports __defineGetter__
and __defineSetter__
, but it doesn't work. Guessing WebKit is protecting that property somehow.
So, any ideas of how to achieve the same effect in WebKit?
In Firefox it's possible using the following...
HTMLDocument.prototype.__defineGetter__("cookie",function (){return "foo=bar";});
HTMLDocument.prototype.__defineSetter__("cookie",function (){});
This doesn't cause any errors in WebKit, and WebKit definitely supports __defineGetter__
and __defineSetter__
, but it doesn't work. Guessing WebKit is protecting that property somehow.
So, any ideas of how to achieve the same effect in WebKit?
Share Improve this question asked Jun 14, 2009 at 8:47 netnicholsnetnichols 2513 silver badges4 bronze badges1 Answer
Reset to default 6Have you tried do define the getter/setter pair on the document object itself, instead on the prototype?
document.__defineGetter__("cookie", function() {} );
document.__defineSetter__("cookie", function() {} );
I know it shouldn't matter, but I don't underestimate browser quirks. Even with WebKit.
Update
I've done some tests in Chrome 2 and it appears that it only allows defining a setter. Anyway, I'm not sure how valid this observation is to WebKit, as Google Chrome uses a different JavaScript interpreter than WebKit.
本文标签: javascriptIs it possible to override documentcookie in WebKitStack Overflow
版权声明:本文标题:javascript - Is it possible to override document.cookie in WebKit? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745162974a2645531.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论