在设置cookie时始终打破JavaScript执行 [英] Breaking JavaScript execution always when cookie is set
本文介绍了在设置cookie时始终打破JavaScript执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在设置cookie时是否有可能在FireBug(或其他一些Web开发人员工具)中破坏javascript执行(没有明确设置JS断点)?
Is it possible to break javascript execution in FireBug (or in some other web developer tool) always when cookie is set (without setting JS breakpoints explicitly)?
document.cookie = '...';
Harri
推荐答案
这应该有效(在控制台中运行):
This should work (run it in a console):
origDescriptor = Object.getOwnPropertyDescriptor(HTMLDocument.prototype, 'cookie');
Object.defineProperty(document, 'cookie', {
get() {
return origDescriptor.get.call(this);
},
set(value) {
debugger;
return origDescriptor.set.call(this, value);
},
enumerable: true,
configurable: true
});
这篇关于在设置cookie时始终打破JavaScript执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文