Friday 9 August 2013

Disable all events in web pages.

1.  Disable all events of a page.
<script language="javascript" type="text/javascript">
 $(document).ready(function() {
            $(document).bind("contextmenu", function(e) {
                     return false;

             }); 
}); 
 </script>
2.  Disable all events in Iframe.
 <script language="javascript" type="text/javascript">
      function disableRightClick(frameID)
      {
            var ifrm = document.getElementById(frameID);
            var innerDoc = ifrm.contentDocument ? ifrm.contentDocument : ifrm.contentWindow.document;
            $(innerDoc).bind("contextmenu", function(e) {
                return false;
            });
      }

 </script>
 and Call : onload="javascript:disableRightClick('
myframe');"

 NOTE: 
1. must add jquery file (jquery-1.4.min.js) to enable jquery on your page.
2. In iframe put all attrubute in double quote as id="myframe".


Cheers!!




No comments:

Post a Comment