Forum Moderators: mack

Message Too Old, No Replies

disabling the VIEW SOURCE CODE on my page...

i dont want anybody view my source code

         

joan_0618

10:46 am on Oct 15, 2003 (gmt 0)

10+ Year Member




what is the code to avoid anyone check my source code on my page? ill appreciate any help...

benihana

10:52 am on Oct 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



there is no hundred percent way. you could use javascript to open a window with no menus and disabled right-click, but most people who know enough to WANT to view your code will be able to get round that in a few seconds.

ben

keeper

10:54 am on Oct 15, 2003 (gmt 0)

10+ Year Member



Agreed.

There is a comprehensive discussion here too:
[webmasterworld.com...]

Dreamquick

10:55 am on Oct 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can't stop people getting access to the source, if they can display the page then they by definition need access to the source - that is the nature of the web.

You could try irritating users by stopping them right-clicking using javascript, but even that's not infallible and in my opinion it looks incredibly amaturish and not something that should ever be used on a professional website - especially when there are legitimate reasons for your users wanting to keep the right click/context menu functionality.

- Tony

[edited by: Dreamquick at 10:56 am (utc) on Oct. 15, 2003]

limbo

10:55 am on Oct 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The top two links here [google.com] are quite useful.

Why do you want to disable this?

The WWW by definition should be a free and accessible resource (IMO ;) )

There are an number of ways to do it (eg. javascript) but in all but the most advanced cases you will always be exposing you code.

Disable code>> user saves page>> disabale save page>> begin challenge for hacks >> beat off hacks >> encourage batter hacks >> site grafitti >> remove and improve >> word'll get out and they'll come after you..... snowball is getting bigger ..

MonkeeSage

10:58 am on Oct 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Long answer; You can try disabling right-clicks, but they be can be enabled again just as easily (actually, more easily), or a person can use an app like WGET and download the source that way; You can try hiding your code with some JavaScript, but it can be reversed in a matter of minutes (and people with non-JS browsers or with JS turned off won't be able to see your site at all) -- I decoded Mike Chen's WebLockerPro page in about 10 minutes total (just to prove how easy it is).

Long answer short; if your site is on the web, anyone can get your source code.

Jordan

georgeek

11:05 am on Oct 15, 2003 (gmt 0)

10+ Year Member



I decoded Mike Chen's WebLockerPro page in about 10 minutes

That includes a break for coffee right :)

glengara

11:18 am on Oct 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Don't know if it was achieved by accident or design, but I remember a page that seemed to keep downloading long after it was rendered on screen, couldn't view source "normally".

g1smd

7:10 pm on Oct 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Spend time on developing great content rather than messing about with stuff like this. You're worrying about the wrong things.

ronin

11:25 pm on Oct 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You can't really hide your source code, but if you want to make it more difficult for people to see how you've structured your html (I'm not really sure why you'd want to do this...) you can always try stringing it together like this:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><title>My WebSite Title</title><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><meta name="title" content="mytitle" /><meta name="description" content="mydescription"/><meta name="keywords" content="mykeywords" /><!--css files--><style type="text/css"><!-- @import url(/mystyle.css); --></style><!--end css files--><!--javascript files--><script language="javascript" type="text/javascript" src="/js2.js"></script><script language="javascript" type="text/javascript" src="/js1.js"></script><!--end javascript files--></head><body>My WebPage</body></html>

Most people won't want to go through the headache of cutting and pasting into an html editor to sort it out.

deejay

12:38 am on Oct 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ronin - sorry dude, won't make anyone curious about the code hesitate for a second.

cut'n'paste to Word.

Edit, find replace. Find: "<" replace with "^p<"

Clear as day.

If I want to be fussy a second replace of "^p</" with "</" will bring the close tags back onto the same line as the open tags.

At the end of the day, it's just not worth the effort and the impact of annoying genuine users to try and hide source code.

joan_0618

2:17 am on Oct 17, 2003 (gmt 0)

10+ Year Member



may be im worrying bout stuff that has no sense at all (like hiding my source code)...im just starting and its a lesson to me not to mess up www. its a good start for a beginner like me, heading the right track rather than pissing off visitors of my page...thanks for the advice and also for the source code but i think i will never use it on my page anymore...:)

PatrickDeese

2:31 am on Oct 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



the one that always made me laugh was when I saw HTML code with 2 or 3 screen lengths of carriage returns.

<!-- WARNING - THIS SITE IS COPY PROTECTED -->
(insert 20" of blank space)
<html>
<head>
<body>
etc.

Mr Bo Jangles

2:39 am on Oct 17, 2003 (gmt 0)

10+ Year Member



but Patrick, I rekon that for maybe 60% of the population that would be an effective method. Or that coupled with using frames (ug!)

RuthieJo

6:25 am on Oct 17, 2003 (gmt 0)

10+ Year Member



I'm glad you can view source, that's how I've learned
my HTML.

To my way of thinking, if you don't want someone
to view your source, you have something to hide.

MonkeeSage

7:20 am on Oct 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If I had to guess I'd say that most people want to hide their source because they are new to webmastering, they have just spent days (or months) learning the ropes, and now they have a site they are proud of as the result of their labor -- they don't want someone to come along and thief their hard work. An relatable sentiment, no doubt.

Jordan

victor

8:10 am on Oct 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Creating webpages -- and copying them -- are both trivial acts. You can't stop it.

More important is to stop anyone getting hold of your CGI scripts. That's where the really interesting and unique stuff on your site resides.

If you are exposing your CGI directories to casual passers-by, then think again!

TGecho

3:32 am on Oct 19, 2003 (gmt 0)

10+ Year Member



Especially since that interesting and unique stuff could be database passwords and the like.

pmac

3:36 am on Oct 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<edit>

ergophobe

12:12 am on Oct 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




may be im worrying bout stuff that has no sense at all (like hiding my source code)...im just starting

Then the chances are that you don't have anything worth protecting. I don't have any secrets worth protecting and I'm at least an intermediate.

Since I try to write valid code that works in multiple browsers, it is my hope that people will steal from me, though I would prefer they steal from someone who writes cleaner code yet... in other words the same people I steal from!

Someone once warned Woody Guthrie that another singer had stolen one of his songs. Woody said "Oh, he ain't nothin'. He just steals from me, but I steal from everybody."

So Joan - share with everyone, steal from everyone. In the long run you'll have much better pages.

One last thing. Occasionally, when I come across a page that doesn't work and I think I would like the person who wrote the page (for whatever reason, but usually for a small business that I like but is likely losing business because of a bad page), I'll sometimes use view source, see what's wrong and send them a quick note on how to fix it. I would say at this point, I do that more often than I look at the source in order to steal things.

When I want to steal something good, I usually ask how to do it in one of the WebmasterWorld forums and steal from someone who knows what he's talking about ;-)

Tom

ergophobe

12:14 am on Oct 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




ronin - sorry dude, won't make anyone curious about the code hesitate for a second.

cut'n'paste to Word.

Edit, find replace. Find: "<" replace with "^p<"

Nah, just run it through Tidy and it will be all indented, any unmatched tags signalled and so on. It'll look better than typical Frontpage code.

Tom

RuthieJo

3:33 pm on Oct 30, 2003 (gmt 0)

10+ Year Member



You know, I may be new to writing HTML codeing, and like
I said before checking other source codes is how I learn
my HTML, but the website I'm working on, I didn't steal
the code from anybody, I wrote it the hard way, and am
still finding errors. I also have a son who knows how
to use Front Page (I still haven't figured it out) and
he is working on some of my mistakes, and I'm learning
the hard way.

The site I'm working on, I've been working on for over
a year now, and still haven't gotten it up and running,
but when it's on line, I don't think many people will
steal from me, as I don't have any fancy scripts, and
only one small java script (that I didn't write) for the
date and time on my site.

txbakers

7:28 pm on Oct 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



i dont want anybody view my source code

Why, are you embarassed by it?

joan_0618

1:21 am on Nov 3, 2003 (gmt 0)

10+ Year Member



its before, <b>txbakers</b>...
before im somewhat not ready yet to show how simple my html codes looks like but hearing things from people like you whom have been on this field for years of web developing i realized learning is more fun when i shared it with other. either it might be a simple to hard core codes...thanks to all whom have shared their views with me...these will bring me to a long way...

RuthieJo

1:54 am on Nov 3, 2003 (gmt 0)

10+ Year Member



Gee whiz my code is just about as simple as you
can get.

I spent the entire day trying to get everything checked
out on my new website, so I could start sending out the
URL. I spent about three hours trying to figure out why
the Pay Pal buttons wouldn't show up right on 50 of my
catalog pages, I finally had to remove all of the Pay
Pal code and reinstall it on each page. The Pay Pal code
was written by Pay Pal and is the most complicated code
on my site.

Reflect

7:08 pm on Nov 3, 2003 (gmt 0)

10+ Year Member



Just another thought...

By disabling the right click you also take away...

Add to favorites
Print
Back
Refresh

Just an aside,

Brian