Welcome to Dream.In.Code
Getting Help is Easy!

Join 109,717 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,995 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Blocking Source Code

 
Reply to this topicStart new topic

Blocking Source Code

jjsaw5
post 15 Apr, 2008 - 11:14 AM
Post #1


D.I.C. Face

Group Icon
Joined: 4 Jan, 2008
Posts: 985



Thanked 5 times

Dream Kudos: 125
My Contributions


Is there a way you can block people from right-clicking on your web page and viewing your source code?
User is online!Profile CardPM

Go to the top of the page


PsychoCoder
post 15 Apr, 2008 - 11:17 AM
Post #2


DIC.Rules == true;

Group Icon
Joined: 26 Jul, 2007
Posts: 7,253



Thanked 52 times

Dream Kudos: 7775

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, GDI, Boo.Net

My Contributions


There is no fool-proof way. If you use JavaScript then a user simply needs to disable JavaScript to get around it. The only way to keep it safe is to obfuscate it, or encrypt it
User is offlineProfile CardPM

Go to the top of the page

jjsaw5
post 15 Apr, 2008 - 11:20 AM
Post #3


D.I.C. Face

Group Icon
Joined: 4 Jan, 2008
Posts: 985



Thanked 5 times

Dream Kudos: 125
My Contributions


I see. I was on a site the other day and i went to view the source code and a little box popped up and wouldn't let me right click on anything. It was pretty cool so i figured if i ever did i web page it would be something to try.
User is online!Profile CardPM

Go to the top of the page

MRJ
post 15 Apr, 2008 - 11:43 AM
Post #4


D.I.C Head

Group Icon
Joined: 13 Oct, 2007
Posts: 82


My Contributions


If people can see your site in a browser they can see the source code. It's that simple. Any attempt to stop it will fail if anyone really wants it.

Of course you can obfuscate it but even that can be worked around. The web is by nature open and to try and close it is more work then it's really worth.

User is offlineProfile CardPM

Go to the top of the page

PsychoCoder
post 15 Apr, 2008 - 11:55 AM
Post #5


DIC.Rules == true;

Group Icon
Joined: 26 Jul, 2007
Posts: 7,253



Thanked 52 times

Dream Kudos: 7775

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, GDI, Boo.Net

My Contributions


QUOTE(jjsaw5 @ 15 Apr, 2008 - 11:20 AM) *

I see. I was on a site the other day and i went to view the source code and a little box popped up and wouldn't let me right click on anything. It was pretty cool so i figured if i ever did i web page it would be something to try.


You can do that with JavaScript, but all a person would have to do is use the browser menu bar and select View > Page Source and they can see it.
User is offlineProfile CardPM

Go to the top of the page

Nykc
post 15 Apr, 2008 - 11:59 AM
Post #6


I has D.I.C

Group Icon
Joined: 14 Sep, 2007
Posts: 3,146



Thanked 6 times

Dream Kudos: 250
My Contributions


It really is more hassle than it is worth. Who cares if someone accesses your source code. As long as you aren't hardcoding passwords for everyone to see.
User is offlineProfile CardPM

Go to the top of the page

jjsaw5
post 15 Apr, 2008 - 06:13 PM
Post #7


D.I.C. Face

Group Icon
Joined: 4 Jan, 2008
Posts: 985



Thanked 5 times

Dream Kudos: 125
My Contributions


QUOTE(Nykc @ 15 Apr, 2008 - 01:59 PM) *

It really is more hassle than it is worth. Who cares if someone accesses your source code. As long as you aren't hardcoding passwords for everyone to see.



I don't really care, just something i was curious if you could do or not. And if so how you would go about doing it.
User is online!Profile CardPM

Go to the top of the page

no2pencil
post 15 Apr, 2008 - 06:21 PM
Post #8


Wet D.I.C.

Group Icon
Joined: 10 May, 2007
Posts: 4,950



Thanked 27 times

Dream Kudos: 2325

Expert In: Goofing Off

My Contributions


Even with all of the JavaScript & mouse click detection, one could click view source code with IE. Control + U in FireFox.

You could obfuscate your html code, or write it in foreign language (bablefish).
User is offlineProfile CardPM

Go to the top of the page

Nykc
post 15 Apr, 2008 - 08:12 PM
Post #9


I has D.I.C

Group Icon
Joined: 14 Sep, 2007
Posts: 3,146



Thanked 6 times

Dream Kudos: 250
My Contributions


Come to think of it, I thought I seen the JavaScript snippet for that in this forum. I am almost positive I did but too lazy to search for it smile.gif
User is offlineProfile CardPM

Go to the top of the page

jjsaw5
post 16 Apr, 2008 - 07:21 AM
Post #10


D.I.C. Face

Group Icon
Joined: 4 Jan, 2008
Posts: 985



Thanked 5 times

Dream Kudos: 125
My Contributions


QUOTE(Nykc @ 15 Apr, 2008 - 10:12 PM) *

Come to think of it, I thought I seen the JavaScript snippet for that in this forum. I am almost positive I did but too lazy to search for it smile.gif



I'll have to look and see if i can find it.
User is online!Profile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 9/8/08 09:16AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month