2 newbie questions

J

JimO

Two questions:
1) Is there a way to keep someone from viewing the source code of a page?

2) Is there a way to keep someone from copying content from a page?

Thanks,
Jim
 
R

Randy Webb

JimO said:
Two questions:
1) Is there a way to keep someone from viewing the source code of a page?
No.

2) Is there a way to keep someone from copying content from a page?
No.

Thanks,

Welcome.
 
P

Philip

In JavaScript, no to both questions.
The problem is that the code is client-side, and so has to be
downloaded with the HTML and then interpreted.

In any server-side language the code will be hidden, like ASP, Perl
etc...

You can't stop the viewer doing a 'View Source'. To be quite honest
looking at other people's code and seeing how they do things is quite
instructive, so perhaps we can all be pleased that we can see other
people's code; but, if only they couldn't see mine, that would be a
good addition to any browser!
 
R

RobG

koethler said:
You can disable the right mouse button this way ...

How does disabling the right mouse button using JavaScript have anything
to do with either of the OP's question?

Disabling the right button does not stop me either viewing the source
or copying the content. Sometimes the mouse I use does not even have
a right button.
 
I

Ivo

You can disable the right mouse button this way by putting the
Hope this has been helpfull.

Quite the opposite. Encouraging people to remove a very fundamental tool,
the contextmenu, from the browser is counter-productive for a number of
reasons. You have no idea how basic and important it is for some people.
Besides, everything that can be done from the contextmenu, can also be done
in some other way, so disabling it merely makes it more cumbersome to do it.
You also didn't cancel the Shift + F10 shortcut key.

Here is a bookmarklet to re-enable the contextmenu on any page that suffers
from an anti-right-click-script, even in frames:

javascript:(function(w){for(var%20i=0;i<w.length;i++){arguments.callee(w.fra
mes);}try{function%20n(r){r.onclick=r.oncontextmenu=r.onmousedown=r.onmou
seup=null;}n(w.document);n(w.document.body);}catch(e){alert('Bookmarklet%20f
ailed:\n\n'+e.message);}})(top);
 

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,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top