473,320 Members | 1,876 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,320 software developers and data experts.

I need some help please


I have a html page that I don't want anyone to print. Is there a way using
JavaScript to send an alert to the user to warn [or stop] them from trying
to print the html page? Is there an onPrint event handler? In my book
'JavaScript a Beginner's Guide' by John Pollock none is listed. Can a
function be written that will execute if someone tries to print the html?
Thanks in advance

P.S. I also have a printable version of the page in pdf which is for
printing
Jul 23 '05 #1
3 2825
Ivo
"Russell McDade" <do******************@all.com> typed
I have a html page that I don't want anyone to print. Is there a way using
JavaScript to send an alert to the user to warn [or stop] them from trying
to print the html page? Is there an onPrint event handler?
There isn't, and if there were, I could use the "Print-Screen" button,
modify the script on the page via the addressbar, turn off Javascript
altogether, etc.etc. The idea is on a par with disabling right-clicks to
"protect" images, it goes against the nature of the web. And for anything
like a solution, knowing why you do not want it in the first place might
help.
P.S. I also have a printable version of the page in pdf which is for
printing


That is certainly nice. If you put the following on your page, who would
want to disturb your peace:
<p>Please do not this page. I also have a <a
href="printableversion.pdf">printable version</a> of the page in pdf which
is for printing.</p>

By the way, we all want help. Descriptive subject lines do just that.
HTH
Ivo
Jul 23 '05 #2
On Sun, 23 May 2004 10:09:27 +1000, in comp.lang.javascript "Russell
McDade" <do******************@all.com> wrote:
|
| I have a html page that I don't want anyone to print. Is there a way using
| JavaScript to send an alert to the user to warn [or stop] them from trying
| to print the html page? Is there an onPrint event handler? In my book
| 'JavaScript a Beginner's Guide' by John Pollock none is listed. Can a
| function be written that will execute if someone tries to print the html?
| Thanks in advance
|
| P.S. I also have a printable version of the page in pdf which is for
| printing
|

<head>
<link rel=alternate media=print href="mypage.pdf">

</head>

or

<style>
@media print {
..noPrint { display: none; }
}
</style>
<body>
<div class="noPrint">
....
</div>
---------------------------------------------------------------
jn****@yourpantsbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------
Jul 23 '05 #3

"Jeff North" <jn****@yourpantsbigpond.net.au> wrote in message
news:bv********************************@4ax.com...

<snip previous>
<head>
<link rel=alternate media=print href="mypage.pdf">

</head>

or

<style>
@media print {
.noPrint { display: none; }
}
</style>
<body>
<div class="noPrint">
...
</div>
---------------------------------------------------------------
jn****@yourpantsbigpond.net.au : Remove your pants to reply


Thanks Jeff, both these techniques work.

Russell

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: mike | last post by:
Hello, After trying to validate this page for a couple of days now I was wondering if someone might be able to help me out. Below is a list of snippets where I am having the errors. 1. Line 334,...
5
by: John Flynn | last post by:
hi all i'm going to be quick i have an assignment due which i have no idea how to do. i work full time so i dont have the time to learn it and its due date has crept up on me .. As follows:...
5
by: TrvlOrm | last post by:
HI There, I have been struggling with JavaScript code for days now, and this is my last resort! Please help... I am trying to create a JavaScript slide show with links for Next Slide,...
7
by: Timothy Shih | last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I wrote a simple function which takes in 2 buffers (one a byte buffer, one a char buffer) and copies the contents of the byte...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
8
by: skumar434 | last post by:
i need to store the data from a data base in to structure .............the problem is like this ....suppose there is a data base which stores the sequence no and item type etc ...but i need only...
8
by: CM | last post by:
Hi, Could anyone please help me? I am completing my Master's Degree and need to reproduce a Webpage in Word. Aspects of the page are lost and some of the text goes. I would really appreciate it....
0
by: U S Contractors Offering Service A Non-profit | last post by:
Brilliant technology helping those most in need Inbox Reply U S Contractors Offering Service A Non-profit show details 10:37 pm (1 hour ago) Brilliant technology helping those most in need ...
21
by: asif929 | last post by:
I need immediate help in writing a function program. I have to write a program in functions and use array to store them. I am not familiar with functions and i tried to create it but i fails to...
5
by: Justin | last post by:
Here's my XML: <?xml version="1.0" ?> <AppMode Type="Network"> <CurrentFolder Path="c:\tabs"> <Tabs> <FilePath>tabs\Justin.tab</FilePath> <FilePath>tabs\Julie.tab</FilePath> *****There could...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.