473,385 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Code to disable Print and Save As

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
Jul 16 '06 #1
15 74682
i need disable save as javascript
Jul 16 '06 #2
sashi
1,754 Expert 1GB
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..
Jul 16 '06 #3
sashi
1,754 Expert 1GB
Hi Baranitharan,

check out the below code.. hope it helps you to get started with.. good luck my fren.. :)

no right click for images..
Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript"> 
  2. <!--
  3. function noway(go) { if 
  4. (document.all) { if (event.button == 2) { alert(popup); return false; } } if (document.layers) 
  5. { if (go.which == 3) { alert(popup); return false; } } } if (document.layers) 
  6. { document.captureEvents(Event.MOUSEDOWN); } document.onmousedown=noway; 
  7. // --> 
  8. </script>
  9.  
no right click for source code..
Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript1.1"> 
  2. <!--
  3. var debug = true; function 
  4. right(e) { if (navigator.appName == 'Netscape' && (e.which == 3 || e.which 
  5. == 2)) return false; else if (navigator.appName == 'Microsoft Internet Explorer' 
  6. && (event.button == 2 || event.button == 3)) { alert('This Page is fully 
  7. protected!'); return false; } return true; } document.onmousedown=right; if (document.layers) 
  8. window.captureEvents(Event.MOUSEDOWN); window.onmousedown=right; 
  9. //-->
  10. </script>
  11.  
Disable Copy and Paste.
Add the following html code to your BODY tag:
Here is how your BODY tag may look once implimented:
Expand|Select|Wrap|Line Numbers
  1. <body bgcolor="#FFFFFF" ondragstart="return false" onselectstart="return false"> 
  2.  
Expand|Select|Wrap|Line Numbers
  1. ondragstart="return false" onselectstart="return false"
  2.  
Jul 17 '06 #4
Banfa
9,065 Expert Mod 8TB
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.
Jul 17 '06 #5
thanks sashi. i am try you sample code...

Hi Baranitharan,

check out the below code.. hope it helps you to get started with.. good luck my fren.. :)

no right click for images..
Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript"> 
  2. <!--
  3. function noway(go) { if 
  4. (document.all) { if (event.button == 2) { alert(popup); return false; } } if (document.layers) 
  5. { if (go.which == 3) { alert(popup); return false; } } } if (document.layers) 
  6. { document.captureEvents(Event.MOUSEDOWN); } document.onmousedown=noway; 
  7. // --> 
  8. </script>
  9.  
no right click for source code..
Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript1.1"> 
  2. <!--
  3. var debug = true; function 
  4. right(e) { if (navigator.appName == 'Netscape' && (e.which == 3 || e.which 
  5. == 2)) return false; else if (navigator.appName == 'Microsoft Internet Explorer' 
  6. && (event.button == 2 || event.button == 3)) { alert('This Page is fully 
  7. protected!'); return false; } return true; } document.onmousedown=right; if (document.layers) 
  8. window.captureEvents(Event.MOUSEDOWN); window.onmousedown=right; 
  9. //-->
  10. </script>
  11.  
Disable Copy and Paste.
Add the following html code to your BODY tag:
Here is how your BODY tag may look once implimented:
Expand|Select|Wrap|Line Numbers
  1. <body bgcolor="#FFFFFF" ondragstart="return false" onselectstart="return false"> 
  2.  
Expand|Select|Wrap|Line Numbers
  1. ondragstart="return false" onselectstart="return false"
  2.  
Oct 15 '07 #6
acoder
16,027 Expert Mod 8TB
Welcome back, baranitharan. Whoa! 15 months after your original post!
thanks sashi. i am try you sample code...
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.
Oct 15 '07 #7
AKS009
4
How to close open/save/cancel dialog box in IE 8 when user click on some button.

please sugest its urgent.
Mar 12 '10 #8
acoder
16,027 Expert Mod 8TB
So you have a dialog open and you want to close it by clicking a button? or did you want something else?
Mar 15 '10 #9
AKS009
4
i need to bypass that open /save/cancel when i will click to open pdf in my web application how can i do that using some code or somewhere else./
Mar 15 '10 #10
acoder
16,027 Expert Mod 8TB
If it's a browser functionality, you'll have to check the browser settings.

Do you want the PDF file to display in the browser without a dialog box or do you want to force a download?
Mar 15 '10 #11
AKS009
4
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.
Mar 15 '10 #12
gits
5,390 Expert Mod 4TB
you might try to add a Content Disposition header with inline and filename before sending the pdf from the server ...

kind regards
Mar 15 '10 #13
AKS009
4
can u just tell me where i need to put this code.. in java file or in JSP...
Mar 15 '10 #14
gits
5,390 Expert Mod 4TB
you will probably have a line where the pdf is send/printed in your code? probably it will be located in a jsp-page? ...
Mar 15 '10 #15
tsubasa
64
I think I saw the solution in the MSDN Developer center, but I can't recall what the subject was under.

-Tsu
Aug 20 '10 #16

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Barry | last post by:
Hello, I've recently noticed that someone can simply type in the URL to my javaScript, from my HTML source code, to the explorer location bar and an auto-save dialog pops up to let them save it...
0
by: scoimbra | last post by:
Hello there, I have a report in an access database that always prints to the MS Image Writer. I have to do this several times a day. Does any of you know how to implement a VB code to print...
2
by: standish22 | last post by:
want to open a word document stored in my database. What I do is save the document locally, and then open a new winform that has the WebBrowser Control on it and navigate to that new file. ...
3
by: Michelle Anderson | last post by:
Hi, I have this code so it will ask user if they want to save if they click on the "close" button. But some how it also pops up the message when I click on the save button. Is there a way to...
0
by: sqldude | last post by:
How can I disable the print preview while printing an excel file from C# code? Thanks.
29
by: Virtual_X | last post by:
As in IEEE754 double consist of sign bit 11 bits for exponent 52 bits for fraction i write this code to print double parts as it explained in ieee754 i want to know if the code contain any...
1
by: Saray | last post by:
Hi, Can you please give me a sample code to print the data to the printer from the excel sheet. Thanks in advance Saray
3
by: flip345 | last post by:
dear all, I want to disable print button in case text box are empty please advise because i am prety unfamiliar with visual basic please please thanks
1
Jogendra Singh
by: Jogendra Singh | last post by:
How we can Disable browser save as Button ?????? Plz help me ???????/
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.