i need a code to disable user print and save as.if there is any javascript plz help me.last 1 month i need this code.the end user never save my pages and print my pages including text image
Code to disable Print and Save As
Collapse
X
-
-
-
Hi Baranitharan,
i have seen right click disable kind of codes around.. if you need a faster solution, you try looking in Google.com.. or else you can post your code segment on your next post and we will help you to validate your code.. take care..Comment
-
Hi Baranitharan,
check out the below code.. hope it helps you to get started with.. good luck my fren.. :)
no right click for images..
no right click for source code..Code:<script language="JavaScript"> <!-- function noway(go) { if (document.all) { if (event.button == 2) { alert(popup); return false; } } if (document.layers) { if (go.which == 3) { alert(popup); return false; } } } if (document.layers) { document.captureEvents(Event.MOUSEDOWN); } document.onmousedown=noway; // --> </script>
Disable Copy and Paste.Code:<script language="JavaScript1.1"> <!-- var debug = true; function right(e) { if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false; else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) { alert('This Page is fully protected!'); return false; } return true; } document.onmousedown=right; if (document.layers) window.captureEvents(Event.MOUSEDOWN); window.onmousedown=right; //--> </script>
Add the following html code to your BODY tag:
Here is how your BODY tag may look once implimented:
Code:<body bgcolor="#FFFFFF" ondragstart="return false" onselectstart="return false">
Code:ondragstart="return false" onselectstart="return false"
Last edited by sashi; Jul 17 '06, 04:18 PM.Comment
-
baranitharan - I do not believe there is anyway to do what you want, File -> Save As and File -> Print are functions of the browser that you have no control over as they are not part of any web standard (i.e. HTML, Javascript, CSS etc). They are things that the browser designers put in because they thought they might be useful.
sashi - the things you suggest are worst than useless IMO because they are not deterant to someone who knows what they are doing, all the do is make a site a little more irritating to use.
If you are trying to prevent someone copying something you are publishing on the web then there is only 1 answer, don't publish it. Remember just by displaying it in there browser most people already have a copy of you item in there browser cache which is easy enough to access.Comment
-
thanks sashi. i am try you sample code...
Originally posted by sashiHi Baranitharan,
check out the below code.. hope it helps you to get started with.. good luck my fren.. :)
no right click for images..
no right click for source code..Code:<script language="JavaScript"> <!-- function noway(go) { if (document.all) { if (event.button == 2) { alert(popup); return false; } } if (document.layers) { if (go.which == 3) { alert(popup); return false; } } } if (document.layers) { document.captureEvents(Event.MOUSEDOWN); } document.onmousedown=noway; // --> </script>
Disable Copy and Paste.Code:<script language="JavaScript1.1"> <!-- var debug = true; function right(e) { if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false; else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) { alert('This Page is fully protected!'); return false; } return true; } document.onmousedown=right; if (document.layers) window.captureEvents(Event.MOUSEDOWN); window.onmousedown=right; //--> </script>
Add the following html code to your BODY tag:
Here is how your BODY tag may look once implimented:
Code:<body bgcolor="#FFFFFF" ondragstart="return false" onselectstart="return false">
Code:ondragstart="return false" onselectstart="return false"
Comment
-
Welcome back, baranitharan. Whoa! 15 months after your original post!
Listen to the advice from Banfa. JavaScript cannot disable these things. What you should consider is why you want to do this in the first place. If it's to protect images, just watermark them. Everything appears in the cache anyway, so disabling Save As has no effect on someone that is determined enough.Originally posted by baranitharanthanks sashi. i am try you sample code...Comment
-
basically i have an application which will generate a consolidate pdf for all the user information at last page when user click on a button, i m calling window.open method to open that pdf in a new window,
it is working fine in IE 6 and IE 7
but in iE 8 its is opening addition popup that is open/save/cancel ,i want to avoid that using some code not using browser setting.Comment
-
you might try to add a Content Disposition header with inline and filename before sending the pdf from the server ...
kind regardsComment
Comment