Search code examples
javascriptjqueryhtmljquery-pluginsfacebook-social-plugins

I am using Jquery Social feed. I am getting alert box from another site. how to disable that alert from it


Here is the alert box. I want to disable this alert box.

<script type="text/javascript">
                jQuery(window).load(function() {
                var param = document.URL.split('#')[1];
                if( param != 'www.abc.com' ){
                alert('Here is msg');
            }
        });
        </script>

Solution

  • Simply overwrite alert with your own, empty, function.

    window.alert = function() {};
    

    Integrating it with your code :

    $(window).load(function() {
      var param = document.URL.split('#')[1];
      if (param != 'www.abc.com') {
        alert('Here is msg');
      }
    
    });
    window.alert = function() {};
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>