Page source kept secret!

  Revi 15:52 18 Oct 2005
Locked

I thought all webpages show their code up when you press ´page source´ on the menu. Recently I came across a website whose every page appears as a blank notepad screen when ´page source´ is clicked. How is this done?

  Forum Editor 23:13 18 Oct 2005

but frankly I wouldn't bother. It's considered a petty-minded thing to do, and in any case it's ludicrously easy to circumvent.

Many people think that html code is copyright-protected, but that's not true - it's the text and images on your site which are protected, the html may be used by anyone.

If you want to do a little experiment, put the following code into the head of your html document, save the page and then try right-clicking on it in your browser. Now got to 'View' on the browser toolbar and select 'source'. See what I mean? This particular script only works in Internet Explorer by the way.

Here's the script:-

<script language="JavaScript">

var message = "Sorry, that function is disabled.\n\n";
message += "This page code is protected, and ";
message += "all content is protected.";

function click(e) {
if (document.all) {
if (event.button == 2) {
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;

</script>

  Gaz 25 01:34 19 Oct 2005

You was fooled.

All the website designer did, was put several returns (spaces) in before the html code begins... try scrolling down.

  Revi 07:48 19 Oct 2005

Thanks for your replies. In case you are curious about the site which I came across and hides its code, it is click here.

  Revi 07:54 19 Oct 2005

You were right!

  Forum Editor 18:57 19 Oct 2005

You can view the source on that site.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

OnePlus 5T review

How to draw a mandala

iPhone X review

Les meilleures enceintes Bluetooth à moins de 150 euros