Link to home
Start Free TrialLog in
Avatar of little_princess
little_princess

asked on

prevent view source

how can i prevent anyone viewing my web page to view source code?
Avatar of knightEknight
knightEknight
Flag of United States of America image

suffice it to say that you should save yourself the trouble of trying this, as it will cause you a lot of trouble for very little gained -- and any attempt to do this can be circumvented with a little determination.
There is only one way known to work.  Do not put the code on a web page.  Anything else will fail and all you do trying is to make the page less usable.

No offense intended, but my experience is that nothing think you have to protect is not already widely available somewhere on the net.  You may have put a lot of work into it; and it might be very nice code, but if you have to ask this question it is not likely that you are doing something so advanced that it is new and unique.

Cd&
ASKER CERTIFIED SOLUTION
Avatar of ivanmata
ivanmata

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ivanmata proves the point.  Does not give any real protection, but definitely make the site less usable.  Net result, no real protection, and fewer repeat visitors because the site PITA, that looks like the work of anamateur.

Cd&
Avatar of ivanmata
ivanmata

COBOLdinosaur:

I thought this was a site to offer solutions to people asking for them... not a site to say: 'NO'...

little_princess asked and I just answered what is available on Internet... almost all sites that 'protect' the code follow this steps... so, if little_princess needs to know how, I think it's good to tell her how... not to tell her 'don't do it'...
ivanmata,

>>>I thought this was a site to offer solutions

Some experts are here to offer solutions.

Most of use are here to try and solve problems.  Creating new problems with solutions that don't actually solve the problem, is not what I am here for.

Posting "solutions" is nice if they solve problems.  Posting "solutions" that encourage bad design, just puts another lump in the pile of junk on the Internet.  If what someone wants to do is not a good idea.  Then solving the problem is giving them advice based on experience.

IMHO

Of course I could be wrong.  After all the rest of the dinosaurs are extinct, and maybe trying to help user build usable sites is old fashioned and out of touch.

Cd&
BTW,

There are hundreds of kiddie forums, where this kind of stuff is the daily stock in trade.  The user came here because they were looking for professional advice.  They may not like the advice, but it is the correct advice nonetheless.

Cd&
cobol dinosaur: i agree with you on the whole junk pile analogy BUT what you have to realize is that you're stating your opinion. someone disabling the right-click of a webpage may be for a variety of reasons, maybe they don't want people to (easily) save the images on it. maybe they don't know that you can simply click "view -> source". but for whatever reason they want to do it, who really cares? if that's what they want to do let them do it. as for the whole opening windows and including .js files I would have to agree, that will just make people surf away from your website real fast.
>>>if that's what they want to do let them do it.

I'm not stopping anyone from doing anything.  A user posting a question here is no different than my paying clients.  If they want to do something that is not a good idea, then they need to know it, and they need to know why.

If what they want to do cannot be done, then they also need to be told that, then if someone to offers them a solution and it does not work, they have no one to blame but themselves.

The questioner has not asked for a right click script or any thing else specific.  The have not asked to limit access to code.  The question is: "how can i prevent anyone viewing my web page to view source code? "

A correct response indicating you cannot was posted 11 minutes after the question. End of story. If the user is not going to respond with followup, clarification, or a specific request(at a more appropriate point level) then they obviously are not looking for additional help.

Cd&
Avatar of little_princess

ASKER

thnx all for the comments anyway...thnx ivanmata, COBOLdinosaur, and NOFXjunkee..little_princess :)
oh and thnx knighEknight too :)
Little Princess

Not really a good thing to do, but the following should help if you really wanna do it:

var message="Hands off you thievin' b*****d";
function click(e) {
if (document.all) {
if (event.button==2||event.button==3) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;

Cheers

Umbriel
A right click script will stop about 3% of users.  Mostly those under the age of 5.

Cd&
as usual... Cd& and his rude comments... always disrespecting others comments...

Sorry for not being as smart as you are dude (lol)... I guess that's what we're here for... you can save your agressive comments...

cheers =0)
Ivanmata,

The way to avoid criticism of answers is to assume that the asker of the question is adult enough and professional enough to accept the truth even when it is not what they want to here.  The simple, and well known, fact is that the correct answer to the question is that you cannot do what they want.

Anytime you find one of my comments to be inaccurate feel free to correct any false impression it may leave.  As for the personal comments; keep them out of the thread.  If you have something of a personal nature to say to me do it by email.  The admins will suspend your account if you make a habit of flaming and/or baiting other experts.

Cd&
thnx all for the help..but i don't anybody to get mad or angry from anybody else becoz of my question :)
thnx again..to u Umbriel, Cd, and ivanmata too...
have anice day and by the way...happy new year to all of you...little ;)
you know i would have to come back and agreed with CD on this one. the best advice to give here is advice that will help the author. i've recently begun to convert my website into valid html4 (or maybe xhtml, haven't decided yet) and use css to separate content/design all that. if people had followed good design and standards from the beginning then the web would be a much nicer place to surf.

little_princess: take our advice and don't put anything up in public domain unless you want everyone to have it. if it shouldn't be taken, it shouldn't be posted. simple as that.
Sorry CD,
My bag as I'm new to EE! I'm with you however that it is pretty much impossible to stop people getting at your code (I think you said it yourself that fake browsers are easy enough to write).
Cheers, Umbriel : )
Sorry CD,
My bag as I'm new to EE! I'm with you however that it is pretty much impossible to stop people getting at your code (I think you said it yourself that fake browsers are easy enough to write).
Cheers, Umbriel : )
Cd& others,

While disabling the ability to view source is generally not a good practice, there are instances where it may protect your assets.  www.oddpost.com is a very smooth web-based email client written with DHTML that could easily be 'lifted' if users were able to view source.  Anyone who really wants to reverse-engineer such an application could certainly do so (as with all software) but not being able to do so protects them from the casual hacker.

stevetwenty
for this comment
>>A right click script will stop about 3% of users.  Mostly those under the age of 5.
i think COBOLdinosaur should get points for humor (Mostly those under the age of 5.)

beside that i think there has been a good discuttion so evreyone sholud get
points for participating.

ivanmata should get a liitle more fo his comment.
and since this question is only  20 points he should get them.

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question
state should be finalized as the above recommandation

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Nushi
EE Cleanup Volunteer