Support » Themes and Templates » hide source code to visitors

  • Hi guys,

    Want to know is there anyway to hide the source code viewed to visitors ? And when i right click and click ‘ view source ‘ everything is visible, even the file paths ‘ wp-content/themes ‘ etc . and even the CSS files visitors can access, even all the JS files used are accessible to anybody ( read only ) . So is there any good way to avoid people seeing such source code and CSS ?

    Mebox .

Viewing 8 replies - 1 through 8 (of 8 total)
  • esmi


    Forum Moderator


    So… the browser needs to be able to read your source code to parse it, to display a webpage.

    If the browser can see it, people can see it.

    If you hide it from people, you hide it from the browser…. and you don’t get no web page!

    Thanks for replies both ESMI and Voodoo .

    But, want to know another thing . I have visited some of the wordpress sites designed by big web design / development companies , and all of their source codes are entirely different from what I designed . I know the source code is unique one for a development . But what I say is, when I right click and click ‘ view source ‘ , in their source, ‘ wp-content/themes/ … ‘ things are not there . Only the css styles, div ids and classes and etc are there .

    But the case is entirely different when viewing the source code of my own theme design in my own website . Even when I use Twenty Eleven theme in my website . When I view the source, everything including file paths, directory paths are shown . Even anybody can see what’s the theme used .

    Can u please provide me with a solution ?

    Mebox .

    There is some method by using Javascript code obfuscation. For WP I don’t know. For basic HTML webpages I had done this. Its like when you view source code it gives weird code. Try it out. If anyone gets a way or any clue for using this in WP then kindly update.

    	function strToHex($string)
        		for ($i=0; $i < strlen($string); $i++)
            		$hex .= "%".dechex(ord($string[$i]));
        		return $hex;
    	$message	 = "<h2>UVray90</h2>";
    	$encoded	 = strToHex($message);
    <script language="javascript">
    document.write( unescape( '<?php echo $encoded ?>' ) );

    Try out this bit of code and use the view source code option. It gets the job done for normal use although its not secure or something. I am not good at WP coding. Any nice guys here can get this developed into a pretty good plugin(Maybe there already is one). Do tell me if this is a blunder. 🙂 Cheers.

    and where to put this code in?

    Moderator Andrew Nevins


    Forum moderator

    Vechnost, create your own thread on this issue. If necessary, refer this thread.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘hide source code to visitors’ is closed to new replies.