Intercepting DOM and JS engine calls
I want to intercept DOM object read and write queries fired by JS while getting loaded by the browser. After intercepting these calls, i wish to screen them. I have written the logic for screening but am not able to block the calls.
Is there any way other than modifying source code of the browser to achieve this? I开发者_开发知识库f so pls help me.
You mean like this? (for some reason fails in Fx with illegal operation)
<script>
var oldGet = document.getElementById;
document.getElementById=function(id) {
return confirm('Someone wants to know about '+id+', is that ok?')?oldGet(id):null;
}
window.onload=function() {
alert(document.getElementById('div1').innerHTML);
}
</script>
<div id="div1">Hello</div>
精彩评论