Reputation: 49
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? If so pls help me.
Upvotes: 1
Views: 268
Reputation: 178328
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>
Upvotes: 1