I want to use this code to display a blank page When someone clicks 'veiw source' from either the context menu or toolbar. (if they switch off javascript they are simply redirected, I use another code)
I dont want extra pages popping up, Just the blank page, possibley I could Add an Image aswell?

Not sure how to implement this code, its a bit confusing. I need to know How and where to put bits. If I put it 'as is' in my header, it loops indefinately.

[inline code]
<html>
<head>
<SCRIPT>
<!--
/**************************************************
Speed Code Seal v1.5
Created by Howard Chen
Provided & Modified By http://www.DesignerWiz.com
Your Free Complete Web Development Resource Center
Get more JavaScripts at http://start.at/javascripts/
Bugs report to jdeveloper@telebot.net
This script is free as long as the credits above are kept
**************************************************/
//== BROWSER COPY THE CODE BELOW==
code="<H2><b>Access Denied</a></b></H2>" 
//== BROWSER COPYING STOP HERE ==
//== Code Present ==
//== If Present ==
codeabove=""
n = (document.layers) ? 1:0;function init() { if (n) {document.layers['display'].document.open();document.layers['display'].document.write(unescape(code));document.layers['display'].document.close();}if (!n) document.write(unescape(code));
}//-->
</script>
<title>RESTRICTED AREA: YOU ARE BEING TRANSPORTED</title>
</head>
<BODY bgcolor="#ffffff" text="#ffffff" onLoad='init()' onunload ="document.open('code_seal_v1.5_1.htm','','halfscreen,scrollbars')" <!--www.DesignerWiz.com-- -->
<SCRIPT><!--
if (n) document.write("<DIV ID='display' STYLE='position:absolute; top:0; left:0; width:800; height:600'></DIV>")
//-->
</script></script></body></html>[/inline code]

I think the right answer here is - don't bother. Wanting to hide CSS, HTML and JavaScript is

  1. difficult if not impossible
  2. quite against the spirit of the web - at one time or another we have all benefited from looking at other peoples' code so you shouldn't complain when it is payback time

Sure there are times when you want to keep all and sundry from knowing how you do certain things. When that is the case consider doing one of the following

  • Use server-side logic do to all that is needed.
  • Use the XMLHTTPRequest object along with the JavaScript eval function to have the code downloaded and executed on the fly. This does not "protect" it but does make it a lot less accessible.

Ok thanks For that, I just wanted to make it 'not worth the effort' for certain cut N pasters to continue ripping content for a rival site.
I use Ondrag/onselect return false, but they know how to veiw source.
This is evidenced by the copied content on their site full of markup like '<br>' and <p> .
Its just annoying really. I could unescape scramble it but its a pain to me as I have to unscramble to edit coding.

Thanks for the Reply mate.

Thanks again mate!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.