Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

Disable print functionality from Internet Explore while playing swf (flash) file

$
0
0

I am facing issue in internet explorer where I am showing swf file (flash) in browser with object and ebmeded html tag. I have written java script which will capture onkeydown event and check if control button is pressed or not.  If pressed then show alert message to user. But I am facing issue like when ever page is loaded first time and if I pressed CTRL key then it showing me alert message correctly but when  I pressed next button of flash player in browser or click on any object from flashplayer, onkeydown event is not capture further. Here I attached HTML code for same. But same functionality working correctly in FireFox and Croma.  Request you to please give me solution for to how to disable printing option (short cut from keyboard)  while playing flash file in Internet Explorer.

<html>
<head>
<head>
</style>
</head>
<meta http-equiv="Content-Type" content="text/html">
<script language="javascript">
var message ="This action is not Allowed!";
if (document.addEventListener)
{
document.addEventListener ("keydown", detectspecialkeys,false) ;
}
 else if (document.attachEvent)
 {
document.attachEvent ("onkeydown",detectspecialkeys); 
 }
if (document.layers) {
alert("capture");
document.captureEvents(Event.MOUSEDOWN || Event.onkeydown);
}
function detectspecialkeys(e){

    var evtobj=window.event? event : e
    if (evtobj.altKey || evtobj.ctrlKey || evtobj.shiftKey)
        alert("you pressed one of the 'Alt', 'Ctrl', or 'Shift' keys")
}

document.onmousedown=click;
function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message)
return false;
}
}
if (document.layers) {
if (e.which == 3 || e.which==17) {
alert(message)
return false;
}
}
}


Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>