denying source code

Posted on 1999-01-06
Last Modified: 2010-04-09
How do you make so that the surfer cannot acccess your source code and steal your graphics by right clicking on your webpage?
Question by:scorp010699
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +5
LVL 10

Expert Comment

ID: 1841390
This is a terrible thing, but it cannot be done.  

Expert Comment

ID: 1841391
Use a java applet that displays your text and pics.
For pics, you can use plug-in formats to make it harder.
But I guess that is too complicated for what you want, so let me explain to you how the Web works. If you surf to a page, your browser requests the page's source (the HTML) from a server. Then it displays an interpretation of the source. This means the user can always see the source, because its client (the browser) has to download it before it can do anything.

Author Comment

ID: 1841392
their has to be a way cause i seen it in some cat's webpage. whenever i right clicked i got a popup window that said something to the effect "No you can't steal my code or graphics"
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 84

Expert Comment

ID: 1841393
So, all you want is a popup window with a message that tells people who have Javascript enabled not to steal your graphics?

Author Comment

ID: 1841394
no. i remember cruising along the internet and i found a site. I was actually plannin on stealin the email gif but when i right clicked anywhere inside the ie instance to recieve the list with all them options i got a popup box that said "No you can't steal my ****" and no menu ever appeared.

Expert Comment

ID: 1841395
u can do one thing that is u can make the browser not see ur  scource code .there is an option in javascript.
<script language="javascript">
<!-----hide these from other browers..
ur program....
stop hiding--->

Expert Comment

ID: 1841396
fundoo: that's not hiding, that's making it a comment so that older browsers don't give an error when they parse the script. Source code is still fully visible.

scorp: do you remember where you saw it? Are you sure it was not an applet or ActiveX control?

Expert Comment

ID: 1841397
You can write a script which traces the right clicks. However, it will only work in NN4/IE4. Here are a few work-arounds:
* Use telnet (or write a Perl script or something like that) to get the page source. Look up the images' URLs and go there.
* Use NN4, press Ctrl-U to get the source. Do as above
* Use IE4, press Alt-V-C to get the source. Do as above
* Use NN4, press Ctrl-I. You'll get a list with all the images at the page. Just click and download.
* To be continued...

In other words, you can hide it from the newbies. The more experienced users will find a way around.


Expert Comment

ID: 1841398
This comes from Microsoft themselves.

You cannot overwrite Windows context-sensitive menu (meaning right clicking will always bring the context menu up).  This will be changed in the upcoming IE5.  In IE5 you can do this.

If you have the URL for that site, please give it out.  I am more than interested on how they are doing it.  My guess for now is that it's an Active X control.

I'd agree with MasseyM rejected answer and Martin's previous post.  You can't.  Show me a page that is done purely in HTML and Javascript and I'll show you the code behind them.


Author Comment

ID: 1841399
hey fundoo, seems i'm going to have to except your answer but w/ one Q. What goes where you put "ur program" do you mean the url ?
LVL 10

Expert Comment

ID: 1841400
fundoo's answer has NOTHING to do with hiding source code. It is just there so that browsers that do not support javascript wil not display it in the window.  

Expert Comment

ID: 1841401
MasseyM: don't waste your time on this anymore, mate. We're going to file this one in the "amusing ridiculous answers" section:-)

Accepted Solution

y2kwacko earned 30 total points
ID: 1841402
yes scorp is correct there is a java script some users use that doesnt stop from viewing source rather it uses the alert (msgbox) to pop up even though the menu is still available due to the alert getting active window status(modal) the menu doesnt show as it lost focus too fast this will only work in ie4+ as far as im concerned another problem you will have disabling right click will not stop them from viewing source as they can use the "View" you can stop both by making the page with a frame so if they use the menu it will show em framesets and you can disable right click by adding this to your html file

<SCRIPT language=javascript>
function click() {
if (event.button==2) {
alert('Sorry, This menu has been disabled.')

lemme know if this works for you


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Filktering Alphabetically 8 41
Mobile apps - web/native or hybrid? 1 66
How to pass values to HTML-5 attribute dynamically? 24 45
Need help with FaceBook login 2 17
When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question