disabling content copying in IE8

M

Marcin Ochocki

Hi,

Is there any way to disable content copying in IE8 using javascript?
I've tried several solutions from the web, but IE8 keeps displaying
"Internet Explorer has restricted this webpage from running
scripts..."

I need solution that works both in FF and IE8.

Thanks
M
 
E

Evertjan.

Marcin Ochocki wrote on 22 jun 2010 in comp.lang.javascript:
Is there any way to disable content copying in IE8 using javascript?

Do you want to "disable content copying in IE8" with a javascript script?

or

do you want to disable "content copying using javascript" in IE8?

Even if either were possible, quoq non,
then what about the same content being copied with Chrrome, FF or IE7?
 
D

Disc Magnet

Hi,

Is there any way to disable content copying in IE8 using javascript?
I've tried several solutions from the web, but IE8 keeps displaying
"Internet Explorer has restricted this webpage from running
scripts..."

I need solution that works both in FF and IE8.

Thanks
M

What is the use of such a solution? The user can always disable
JavaScript and copy content. I feel you don't understand how the web
works. When a user visits a page from your website, all the content
from your website's page has already arrived at the user's computer.
Now, once all the content is present on the user's computer, there is
no way you can stop him from accessing the content.

Even if you write some silly JavaScript hacks, a user can always use a
script, crawler, telnet or simply disable JavaScript in his browser to
right click and copy the content on your website.

The best thing to do would be to accept how the web works, not be
silly and not try to prevent users from accessing your website in a
normal way. There are copyright laws to protect your content from
misuse by your users.
 
M

Marcin Ochocki

I want just to disable content copying in IE8. I have found lots of
javascript exaples, but they're not working in IE8 (at least until you
agree to enable the script)

M.
 
D

Disc Magnet

I want just to disable content copying in IE8. I have found lots of
javascript exaples, but they're not working in IE8 (at least until you
agree to enable the script)

M.

Did you even read my response? Why do you expect IE8 to execute
JavaScript without the user's permission?

I'm glad IE8 allows JavaScript to execute only after the user agrees
to enable the script. IE8 users don't have to put up with idiotic
scripts like the one you want to write.
 
M

Marcin Ochocki

Of course I understand all of this but:
1. By silly solution I can prevent silly users from copying the
content
2. My client insist on such functionality :)

M.
 
D

Disc Magnet

Of course I understand all of this but:
1. By silly solution I can prevent silly users from copying the
content
2. My client insist on such functionality :)

M.

Sigh! As a programmer and a web designer, you must tell the right
thing to your client that the web is open. Content copying prevention
is not possible. But there are laws to help prevent misuse or violate
one's copyright.

However, if the client still insists on this idiotic solution, you
have to tell them the truth that IE requires the user's permission to
execute JavaScript. You should also tell them that JavaScript can also
be completely disabled in a browser. Many Firefox user's already use
NoScript plugin to disable JavaScript execution in most websites.

What you are looking for is impossible by the very design of the world
wide web and IE8.
 
J

Jeremy J Starcher

Of course I understand all of this but:
1. By silly solution I can prevent silly users from copying the content
2. My client insist on such functionality :)

Clients can (and will) insist on a lot. At some point you have to inform
the client that their request is either unreasonable or impossible.
 
T

Thomas 'PointedEars' Lahn

Marcin said:
Is there any way to disable content copying in IE8 using javascript?
I've tried several solutions from the web, but IE8 keeps displaying
"Internet Explorer has restricted this webpage from running
scripts..."

You are not ready for this yet. A (local) Web server gets you started.
I need solution that works both in FF and IE8.

Forget it, there isn't one. Even if there were, users would only need to
turn off script support in order to copy the content. What is published (on
the Web) is automatically protected by national or international copyright,
so either don't publish or don't worry.


HTH

PointedEars
 
B

Bwig Zomberi

Marcin said:
I want just to disable content copying in IE8. I have found lots of
javascript exaples, but they're not working in IE8 (at least until you
agree to enable the script)


When you run a script from a local file, IE will show that warning.

C:\test.htm

If access it using http, IE will not show that warning.

http://localhost/test.htm
 
E

Edgar Wolphe

I want just to disable content copying in IE8. I have found lots of
javascript exaples, but they're not working in IE8 (at least until you
agree to enable the script)


There is ONE trick that might satisfy your client. The content will
still be available to anyone familiar with page construction and
Javascript, but at least a basic "View Source" will not show the
content.

1) In a separate page, or in your Javascript library page, create the
content in a Javascript Function as a single string and assign the
result to a variable.

function createContent() {

var disp = {all your code};

}

You'll also want a function to print the result to the page:

function prnContent() {
createContent();
document.getElementById("stuff").innerHTML = disp;
}

2) In your web page, load the page above in the <head> section, then
assign the spot where you want the code to appear and call the content
printing function last:
<head>
<script type="text/javascript" src="Content.js"></script>
<head>
<body>
[...]
<div id="stuff"></div>
[...]
<script type="text/javascript">prnContent()</script>
</body>


Now, when the user tries a "View Source", the most they'll see is the
container <div>, but not the actual content. Of course, if said user
is familiar with page construction and Javascript, it won't take long
to find where you hid it.

I too had a paranoid client and used the above to "hide" the content.
But be honest with the guy, and explain that while there is truely no
way to prevent content copying, at least this method, crude as it is,
will stop a lot of folks.


EW

4) Call prnThis() AFTER the page has loaded.

This is a
 
E

Evertjan.

Edgar Wolphe wrote on 24 jun 2010 in comp.lang.javascript:
Now, when the user tries a "View Source", the most they'll see is the
container <div>, but not the actual content. Of course, if said user
is familiar with page construction and Javascript, it won't take long
to find where you hid it.

This in the address bar

javascript:document.write(document.body.innerHTML.replace(/</g,'<br>&lt;'))

and all the effords are futile
 

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

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,150
Latest member
MakersCBDReviews
Top