WordPress.org

Ready to get started?Download WordPress

Forums

hide source code to visitors (9 posts)

  1. mebox
    Member
    Posted 2 years ago #

    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 ?

    Thanks,
    Mebox .

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    Nope.

  3. Rev. Voodoo
    Volunteer Moderator
    Posted 2 years ago #

    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!

  4. mebox
    Member
    Posted 2 years ago #

    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 ?

    Thanks,
    Mebox .

  5. uvray90
    Member
    Posted 1 year ago #

    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. http://htmlobfuscator.com/ Try it out. If anyone gets a way or any clue for using this in WP then kindly update.

  6. uvray90
    Member
    Posted 1 year ago #

    <?php
    	function strToHex($string)
    		{
        		$hex='';
        		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 ?>' ) );
    </script>
  7. uvray90
    Member
    Posted 1 year ago #

    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.

  8. vechnost
    Member
    Posted 1 year ago #

    and where to put this code in?

  9. Andrew
    Forum Moderator
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic