Not to copy text from a web page

S

Sillu

I'ld like to create a web page, from which no one can select the text
simply, copy frm there n paste at another location. In simple means,
i'ld like to stop copy process from my web page. Plz suggest
JavaScript code for this purpose.
 
R

RobG

I'ld like to create a web page, from which no one can select the text
simply, copy frm there n paste at another location. In simple means,
i'ld like to stop copy process from my web page. Plz suggest
JavaScript code for this purpose.

Impossible. The following FAQ items are in regard to script, but the
same holds for any other content in the page - if you publish it on
the web, it can be saved locally:

<URL: http://www.jibbering.com/faq/#FAQ4_1 >
<URL: http://www.jibbering.com/faq/#FAQ4_5 >

<FAQENTRY>
Perhaps the items on page protection can be rolled into one, and be in
regard to page content in general as well as just for script
</FAQENTRY>
 
T

Tom Cole

Impossible. The following FAQ items are in regard to script, but the
same holds for any other content in the page - if you publish it on
the web, it can be saved locally:

<URL:http://www.jibbering.com/faq/#FAQ4_1>
<URL:http://www.jibbering.com/faq/#FAQ4_5>

<FAQENTRY>
Perhaps the items on page protection can be rolled into one, and be in
regard to page content in general as well as just for script
</FAQENTRY>

Wouldn't it at least make it a lot more difficult if the body of a
document had only a single div element and the actual page contents
were retrieved through an Ajax call and appended to the div node? A
view source request would then only show the div (unless you had
something like the Firefox developer toolbar which will show generated
source).
 
E

Evertjan.

Tom Cole wrote on 01 mrt 2007 in comp.lang.javascript:
Wouldn't it at least make it a lot more difficult if the body of a
document had only a single div element and the actual page contents
were retrieved through an Ajax call and appended to the div node? A
view source request would then only show the div (unless you had
something like the Firefox developer toolbar which will show generated
source).

Yes, if you were not able to type or copy in the IE address bar:

javascript:w=window.open('');w.document.write(document.body.innerText);
void 0

[beware of linebreaks]

Please Tom and Sillu, accept what is known for years, that what you
publish on the web is available on the web, also for copying.
 
P

plemon

Tom Cole wrote on 01 mrt 2007 in comp.lang.javascript:




Wouldn't it at least make it a lot more difficult if the body of a
document had only a single div element and the actual page contents
were retrieved through an Ajax call and appended to the div node? A
view source request would then only show the div (unless you had
something like the Firefox developer toolbar which will show generated
source).

Yes, if you were not able to type or copy in the IE address bar:

javascript:w=window.open('');w.document.write(document.body.innerText);
void 0

[beware of linebreaks]

Please Tom and Sillu, accept what is known for years, that what you
publish on the web is available on the web, also for copying.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)- Hide quoted text -

- Show quoted text -

the only full proof way is to make them images
 
R

Randy Webb

plemon said the following on 3/1/2007 1:34 PM:

the only full proof way is to make them images

Pure unadulterated garbage advice.
To prove your point, you are welcome to provide a test page as a proof
of concept and I will copy your text for you.
 
E

Evertjan.

Randy Webb wrote on 01 mrt 2007 in comp.lang.javascript:
plemon said the following on 3/1/2007 1:34 PM:

"fool" proof?

Kings II 17:10: "And they made them Images ..."
Pure unadulterated garbage advice.
To prove your point, you are welcome to provide a test page as a proof
of concept and I will copy your text for you.

Even without going for a technical solution,
keyboards are cheap these days.
 
D

dd

I'ld like to create a web page, from which no one can select the text
simply, copy frm there n paste at another location. In simple means,
i'ld like to stop copy process from my web page. Plz suggest
JavaScript code for this purpose.

You can't make it impossible. If it gets into your
browser as text (and not an image) then it's available
in so many ways (browser cache, view source, network
trace, file-save html page etc etc. So you really can't
prevent it in any fool-proof way. Even if you made it
an image, a basic graphics package can read it with an
OCR scan.

I have visited sites that do make attempts to stop
the simple users from doing it though. Some sites
try to catch the keypresses (control-C), or try to
detect attempts to highlight the text (capturing the
mouse drag events), or detecting the right-click
where people are trying to select "Copy".

It's probably not worth it though. The simple users
aren't going to do anything useful with your text.
The advanced users can get around whatever you do.
 
R

Randy Webb

Evertjan. said the following on 3/2/2007 3:19 AM:
Randy Webb wrote on 01 mrt 2007 in comp.lang.javascript:


"fool" proof?

Kings II 17:10: "And they made them Images ..."


Even without going for a technical solution,
keyboards are cheap these days.

Precisely :)
 
R

Richard Cornford

Jim Land wrote:
[Disclaimer: As others have pointed out, there is no way to
absolutely stop a user from copying the text from a page on
the web.]

However, you just want to stop a user from using a mouse to
select and copy text on a web page. This is possible.
Just make it impossible to use the mouse to select text.

It is not possible to make it _impossible_ for the user to select text
and copy it.
I ran across it here:
http://www.snopes.com/politics/soapbox/rooney4.asp
The text on that page is just ordinary text, but it can't
be selected in FF and IE.

Their method, simplified, looks like this:

if (typeof document.onselectstart!="undefined") {
document.onselectstart=new Function ("return false");
}else{
document.onmousedown=new Function ("return false");
document.onmouseup=new Function ("return true");
}

Apart from using a browser that allows javascript execution to be toggled
on and off with a keypress, a simple javascript URL will defeat that. For
IE, for example, a simple:-

javascript: void (document.onselectstart = null);

typed into the address/location bar followed by pressing the return key
will make it possible (even trivial) to select and copy text from the
browser (and that is without even considering acts such as pulling the
source files from the browser's cache and copying the text from those).

Richard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top