How to prevent, stop or kill Javascript function?

How to prevent the execution of this Javascript function.

I have a js function that is causing a serious problem and I cannot remove or modify it. I would like to know if it is possible to simply prevent, stop, or kill a function so that it does not execute until I resolve the problem.

So, somewhere inside the page:

<script type="text/javascript"><!-- problem_func(); //--></script> 

And all I want is to stop this function from executing by putting a cork inside the header or external js.

Any tips?

HERE A LIVE EXAMPLE HOW TO STOP? http://jsbin.com/uxalag/3

+8
javascript dom javascript-events
source share
2 answers

If you know the name of the function, you can replace it with a function that does nothing. After the script tag of the js source file, use this:

 window.FunctionName=function(){return false;}; 
+9
source share

Just rewrite it

for example, if a function abc() { ..... } causes problems, you can overwrite it with an empty body.

 function abc() { } 
+5
source share

All Articles