EMAIL support@unlimited-space.com or CALL us on 1300 657 422



Domain Availability Search

Source Code

Post your questions about PHP, MySQL, Perl, HTML, JavaScript coding and website design

Source Code

Postby Donna on Tue Feb 03, 2009 11:53 am

Hi,

I have noticed on a few sites that when you go View---Source to look at the Source code nothing is shown & nothing happens.
It is totally blocked from view, i have a need to do this for some parts of my HTML code & was wondering if someone could help out with what to do on this subject.

Thanks
Donna
 
Posts: 5
Joined: Thu Jan 29, 2009 4:16 pm

Re: Source Code

Postby Adam S on Tue Feb 03, 2009 5:35 pm

Hi Donna,

There is no effective way to block access to the source code of any page: for the page to be readable by browsers and search engines, the source code has to be accessible, and so can be copied. That's just how the web works: HTML is sent as a text document and interpreted client-side.

There are a lot of people out there who disable the right click function to prevent others from clicking "view source", a lot of web designers can get around this very easily. I use an extension with my browser which allows me to view the source code without actually right clicking the interface of the website.

The only real way the source code can be hidden is if you convert your HTML into a flash which would take too long and become a hassle to maintain.

Here's a read which you may find interesting: http://www.sitepoint.com/forums/showthread.php?t=419751
Unlimited Space Customer Service | support@unlimited-Space.com
http://www.unlimited-space.com | P: 1300 657 422 | F: 03 9532 1346
Adam S
Site Admin
 
Posts: 156
Joined: Thu Oct 09, 2008 3:05 pm
Location: Melbourne

Re: Source Code

Postby Shannon W on Wed Feb 04, 2009 11:29 am

Hi Donna,

Here is a piece of code that may help. It disables the right click feature in IE and FireFox. This will help prevent some people from trying to steal images or code, however it does not disable the View -> Source command from the top menu.

Also, as Adam said above, there is no real way to completely stop someone from accessing your code. If you find someone has stolen your code and the text on their website copies yours word for word, you should contact the relevant Copyright authorities (information here http://www.ag.gov.au/www/agd/agd.nsf/Page/Copyright).

Code: Select all
<SCRIPT LANGUAGE="JavaScript">
<!--

var message="";

function clickIE()

{if (document.all)
{(message);return false;}}

function clickNS(e) {
if
(document.layers||(document.getElementById&&!document.all))
{
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else
{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
// -->
</script>

If you have any more questions, please feel free to ask.

Regards,
Shannon
Shannon Walsh | Customer Service Manager | Unlimited-Space.com
http://www.unlimited-space.com | P: 1300 657 422 | F: 03 9532 1346
Shannon W
Site Admin
 
Posts: 196
Joined: Fri Oct 10, 2008 6:51 am
Location: Melbourne


Return to Designers & Developers Lounge

Who is online

Users browsing this forum: No registered users and 0 guests

cron