blocking RIGHT CLICKING?

whats the code for a link so that people can NOT right click on it...and that the URL is blocked from view?

on the bottom left of the browser a message appears instead of the URL and if you do RIGHT click a grey window pop up warning message appears??

thanks....
mednotes99Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mednotes99Author Commented:
a warning message telling you DONT RIGHT CLICK....
0
chewymonCommented:
It is generally done with JavaScript.  Here are three scripts I have collected from various sources.  There are many more aout there.  Check any JavaScript site.

<SCRIPT>
/* Disable right click (c) 1999 martin & michel@irt.org */
document.onmousedown = right;
function right(e) {
var msg = "Right-click is disabled on this site.";
if ((document.layers && e.which == 3) || (document.all && event.button==2)) { alert(msg); return false; }
return true;
</SCRIPT>

<script language="javascript">
<!--
function right(e) {
var msg = "This Function has been disabled!.";
if (navigator.appName == 'Netscape' && e.which == 3) {
alert(msg);  // Delete this line to disable but not alert user
return false;
}
else
if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
alert(msg); // Delete this line to disable but not alert user
return false;
}
return true;
}
document.onmousedown = right;
// -->
</script>


<SCRIPT LANGUAGE="JavaScript">
<!-- Begin

var ie4 = document.all;
var ns4 = document.layers;

if(ns4) document.captureEvents(Event.MOUSEDOWN);

document.onmousedown = right;

function right(e){
   var msg = "Sorry, you don't have permission to right-click.";
   if (ns4 && e.which == 3)
   {
      alert(msg);  // Delete this line to disable but not alert user
      return false;
   }
else
   if (ie4 && event.button==2)
   {
      alert(msg); // Delete this line to disable but not alert user
      return false;
   }
return true;
}

function trap() {
if(navigator.appName == 'Netscape' && document.images)
   {
   for(i=0;i<document.images.length;i++)
      document.images[i].onmousedown = right;
   }
}

// End -->
</SCRIPT>


0
mednotes99Author Commented:
your answer is great but ill give you another 100 points if you could tell me how i can HIDE the html source so people cant read that

ive heard that some places can encrypt your source.

if you dont know this..ill still give you the 100pts rather than 200


thanks!!
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

chewymonCommented:
It is impossible to competely hide the HTML source of a page.  You can make it more difficult to find, but with the modern browsers, the user can always choose to save the page to his harddrive, then open it in a text based HTML editor such as Arachnophilia or even NotePad. The whole point of the development of HTML was to make the information easily accessable between computers.  Why do you wish to hide the source?  If you can explain what you are trying to accomplish, maybe we can suggest another method of doing it.
0
mednotes99Author Commented:
you are indeed MISTAKEN

here is the proof: yesterday i found a web site that has since disappeared that offered you to submit your html and then click a button and i believe it was a java script which then encrypted the source.

in the end the result is this:
here is a web site i built that doesnt need html encryption but compare these 2 links which are basically the same except the SECOND one is encrypted...try to do view source for each of the links...and you get something that looks VERY Different:

LINK 1
http://www.angelfire.com/journal/medsnn/index.html

LINK2
http://www.angelfire.com/journal/medsnn/newpage1.htm

just compare..they are the same except second one is encrypted.

so because that web site that offered the script to do this is gone...im asking you for a way to encrypt or hide the source.


another example of a "hidden source":
http://c2c.bestwarezsites.com/


so please let me know if you can help me in this regard..if so i definitly will give you 200pts. if not id give you100
0
mednotes99Author Commented:
heck and with the http://c2c.bestwarezsites.com/ 

web page you cant even SAVE the page by going to FILE > SAVEAS

it wont work ..they got it to not progress beyond 81%.

id like to know how to have the things they do on that web page!


0
mednotes99Author Commented:
actually scratch what i said that the site http://c2c.bestwarezsites.com/ 
wont letyou save it...you can

but i still cant get the source...NOT that i want to rip from them..i dont!
i just want to know the tricks to hiding the source like they do.

try yourself to get it...i cant

thats what id like to know how to do.
thanks
0
chewymonCommented:
The source in link 2 tells you where to go to get the encoder.  The warez site was easy.  View the source, see that entrance.htm was the source for the top frame,open http://c2c.bestwarezsites.com/entrance.htm  in Netscape Composer, click on "edit HTML source", and there it was.
0
mednotes99Author Commented:
but how about once you ENTER the site
and click on lets say to go to the MAIN APPZ section...
then how do you see the source?

0
chewymonCommented:
The medical page was a little more work.  The encrypter just puts code characters in that the browser interprets.  Example:

Note%20Network%20helps%20students%20learn%20medicine

%20 is the code for a space so this reads:


Note Network helps students learn medicine

DOCTYPE%20HTML%20PUBLIC%20%22-//W3C//DTD%20W3%20HTML//EN

becomes

DOCTYPE HTML PUBLIC-//W3C//DTD W3 HTML//EN

With a reference page for all the codes of the character set, one could read it out.  Or paste it into a text editor and use "find and replace" for all the character codes.

As I said, you can make it difficult, but as far as I know it is impossible to completely hide the source code from a knowledgeable user.

0
mednotes99Author Commented:
simply put that you would see the URL Links to each of the links

from the appz section, etc.
0
mednotes99Author Commented:
your good..

but still can u get the source to see the links for all the APPZ in their APPZ section on the warez page?

and where can i get the script to do what i did with the medicine page?

0
chewymonCommented:
You have to understand how framesets work.  The source is for the frameset.  In this case I would have to get the source of entrance.htm as detailed above, find the link that opens the next page, get that source, find the link that opens the apps page, get that source.  A lot of work for little return.  Everything that these sites do with their HTML can be found in any good HTML reference book, or for that matter from the WDVL (Web Developers Virtual Library).
0
mednotes99Author Commented:
PS...their way of blocking right CLICKING on NETSCAPE is cooler..
no window even appears

0
mednotes99Author Commented:
well i could see entrance.htm
and bottom.htm when you do view source
but no other .htms

???
0
mednotes99Author Commented:
Adjusted points to 200
0
chewymonCommented:
Yep, then you open entrance.htm in Composer and find the link to the next page, open that page in Composer, etc...

I suppose there is a script out there to do what was done on the med page, but I don't know about it.  Post a Q in the Perl section and someone will probably write it for you as an excercise.
0
mednotes99Author Commented:
i looked on composer by opening the
entrance.htm page
but i dont see a htm link, do you?
0
chewymonCommented:
Its in the functions.  welcome.htm

function Entrance(){
if (enter != 0){
     WM_setCookie('legalclient','true','true','1','','',-1);
     self.location= "/welcome.htm";
}
else{
     alert("Please Vote For Us! Thanks!");
}

}

Late here, I'm going to bed.
0
mednotes99Author Commented:
ok YOU EARNED THe POINTS...send me a request for them
0
mednotes99Author Commented:
but still im disappointed i DONT SEE ANY URL links for the software they link to...
so am i doing somethign wrong...do you see such urls?

or what?
0
VBTomCommented:
I found that site that encrypts your page.  It can be found at http://www.idrive.com/happywarez/web/enc.html.  Hope this helps.
0
MaxVTCommented:
You aren't doing anything wrong. C2C use a CGI script
to prevent other people from stealing their links (this is called "leeching", I believe). You can't see the links themselves, but instead a CGI is called which will produce a corresponding link to the browser.
0
chewymonCommented:
Just curious, is this an intellectual excercise or do you have security concerns that make you want to hide your source?
0
mednotes99Author Commented:
well i guess its an intellectual excercise and i may want to build a web page in the future where id like that feature (to prevent leaching)

cgi..i know nothing about it. is it free like a geocities account? does it take programming on my part? or is it like lots of java scripts out there that i can just cut and paste it
?
0
chewymonCommented:
Why did you reject the answer after you asked me to post it?

CGI is a type of program that resides on the server and takes information from a website, processes it , and returns some action to the website.  It is a type of program language.  There are many cgi scripts available on the web, but you have to have server access to use them.  Some hosts allow them, some don't, and some allow only ones that they have approved.

There are many that can be cut and pasted, but from your comments I would guess that you will need to do some studying before you will be able to use them.
0
egbservicesCommented:
That site that encrypts your page.  It can be found at
http://www.idrive.com/happywarez/web/enc.html.  
NetScape4.7 can read the source code.... :-( seems to convert it back to html... back to square 1!
Edi
0
egbservicesCommented:
That site that encrypts your page.  It can be found at
http://www.idrive.com/happywarez/web/enc.html.  
NetScape4.7 can read the source code.... :-( seems to convert it back to html... back to square 1!
Edi
0
oubelkasCommented:
mednotes>> please pass chewymon his deserved points. He helped you out and gave much of his time to you. And there's NO way you can completely hide you code from other users. And these encrypters mostly work for IE, so NOT NS and they are pretty easy to undermine, which leads you to the beginning of the Q. Then on http://c2c.bestwarezsites.com/ 
the source can still be viewed, they only disabled the right click (and the rightclick emul-button on the keyboard, pretty interesting though), but still View Source on the browser's toolbar can be chosen. And why should you hide your code from others? I just want to say that chewymon knows what he talks about, ok? :)

Joseph
0
mednotes99Author Commented:
I WANT TO and WILL give Chewymon his 200pts. he definitley earned them...i just waiting to still here a response about cgi...that i mentioned several messages above...

cgi..i know nothing about it. is it free like a geocities account? does it take programming on my part? or is it like lots of java scripts out there that i can just cut and paste it
?

in other words...if i wanted to do what cbc.bestwarez did so you cant tell the url links for their software..could i do that for free and where could i do it for free?
0
chewymonCommented:
In any good search engine, type cgi tutorials.  This will give you a wealth of information from very knowledgeable people.  Or try www.wdvl.com The Web Developer's Virtual Library is a great resource for learning new techniques.
0
nettromCommented:
for CGI information try either http://www.cgi-resources.com/ for some example scripts, or read the CGI reference documentation on http://hoohoo.ncsa.uiuc.edu/cgi/

the key to understanding CGI, in my opinion, is to remember that it's not a programming language.  it's an _interface_.  the interface is between your web server and applications making you able to process both input & output.  simple examples are mailto-scripts which process the information entered in a form on a web page and then use an MTA to send e-mail to somebody.
0
SycoaznCommented:
we u guys see i have a sort of a same question but a expert helped me and made the window bomb but i abused the script so i decided not to use it and instead of just leaving it i made it so that if u right click u email sumone and it is sort of impossible to view source but u can if they crack it be4 it activates



                       ~William AKA Syco
0
mednotes99Author Commented:
Sycoazn

that sounds very cool...can i have the script?


0
chewymonCommented:
Here is an extensive site on the subject.

http://www.gustavo.net/programming/cgi.shtml
0
AilOCommented:
The RIGHT CLICK disabling script is cool, but ...
if you just disable JavaScript it cant work :)))
0
mkdebontCommented:
So the right-click handler you get from
chewymon.

Now the other problem:
It's not possible to hide the whole code but what you can do is that you make an external file that you include in the file you are going to show. In this way you can show your page and the people how gonna view the source only see the file where its come from.

Now you think: "But they are go to download this file?"

Nooooo, put this file in a protected-directory and they cannot download this file.
0
oubelkasCommented:
>> Nooooo, put this file in a protected-directory and they cannot download this file.

Wanna bet? ;)

Joseph
0
nettromCommented:
>Nooooo, put this file in a protected-directory
>and they cannot download this file.

anything you want to make available on the web has to be accessible by connecting to the web server.  in other words, it's a 2-minute Perl+LWP-job to fetch your code.
0
ReAnCommented:
No problem. Use this method for hide real URL:

create *.js file and place this
function:

goHere(PageID)
{
  var RealURL;

  if (PageID == 1)
    RealURL="page1.html";
  if (PageID == 2)
    RealURL="page2.html";
  ...
  if (PageID == 999)
    RealURL="page999.html";

    window.location.href=RealURL;
}

User cannot see this file as source view :)

for link use code like:

<a href="" onClick="javascript:goHere(555);">
555th page</a>

Good Look!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
oubelkasCommented:
>>User cannot see this file as source view :)

Again,

Wanna bet??

Joseph
0
SycoaznCommented:
What exaclty does that code do?


                        ~William

0
chewymonCommented:
mednotes99 - Are you still with us?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.