Ganesh M

Ganesh M

  • NA
  • 63
  • 54.6k

show content in web page

Sep 25 2012 2:08 AM
Hi,

              I am developing the application for online virtual class.
 i am using following code for prevent copy and save and print

<SCRIPT TYPE="text/javascript">


 function AccessClipboardData() {
            try {
               window.clipboardData.setData('text', "No print data");
           } catch (err) {
              // txt = "There was an error on this page.\n\n";
              // txt += "Error description: " + err.description + "\n\n";
              // txt += "Click OK to continue.\n\n";
             //  alert(txt);
           }
  
       }
  
 
 
 
<!--
    //Disable right click script
    //visit http://www.rainbow.arch.scriptmania.com/scripts/
    var message = "Sorry, right-click has been disabled";
    ///////////////////////////////////
    function clickIE() { if (document.all) { (message); return false; } }
    function clickNS(e) {
        if
(document.layers || (document.getElementById && !document.all)) {
            if (e.which == 2 || e.which == 3) { (message); return false; }
        }
    }
    if (document.layers)
    { document.captureEvents(Event.MOUSEDOWN); document.onmousedown = clickNS; }
    else { document.onmouseup = clickNS; document.oncontextmenu = clickIE; }
    document.oncontextmenu = new Function("return false")

// -->
</SCRIPT>

 <script language="JavaScript" type="text/javascript">
           setInterval("AccessClipboardData()", 300);
           var ClipBoardText = "";
          
           if (window.clipboardData) {
               ClipBoardText = window.clipboardData.getData('text');
               if (ClipBoardText == "") {
                   alert('Sorry you have to allow the page to access clipboard');
                   // hide the div which contains your data
                   document.all("divmaster").style.display = "none"
               } else {
 
                   document.onkeydown = function(ev) {
                       var a;
                       ev = window.event;
                       if (typeof ev == "undefined") {
                           alert("PLEASE DON'T USE KEYBORD");
                       }
                       a = ev.keyCode;
                       alert("PLEASE DON'T USE KEYBORD");
                       return false;
                   }
                   document.onkeyup = function(ev) {
                       var charCode;
                       if (typeof ev == "undefined") {
                           ev = window.event;
                           alert("PLEASE DON'T USE KEYBORD");
                       } else {
                           alert("PLEASE DON'T USE KEYBORD");
                       }
                       return false;
                   }
               }
           }
        
  </script>


but its works fine in IE
but not support in other browser.
How to achieve this?
How to prevent web page from copy save and print and print screen that support all browser

Any other way to show content in web page from database
i am trying it more than one month please any one help me.