Hi
How to hide my source code so to not be viewed?

I think this line of code solve it but where can I put in my source code?

<body oncontextmenu="return false">

</body>

And This is my code

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5</title>
<meta name="description" content="">


<body oncontextmenu="return false">
<style>
body {
    background-image: url(pics/paris.jpg);
    background-position: center top;
    background-size: 105% auto;
}
</style>

</head>



<h3 align="center">Hello World</h3>
</body>

I appreciate your help

Recommended Answers

All 9 Replies

You can't. HTML is interpreted by the browser, so it's downloaded no matter what. You can obfuscate it a little, or make it harder for inexperienced users, but it's always viewable.

Yeah its almost impossible to hide the HTML code

Any code to hide the HTML code?

The problem here is that the browser downloads the HTML as pritaeas described. While you can apply techniques to make it more challenging to read, you cannot ultimately prevent someone from getting your HTML code.

I dont even need a browser. There are a variety of other tools as well that can be used to look at the HTTP traffic that was downloaded from the web server.

so, your techniques may make it more chanllenging for those that are not skilled, but not possible for those that have the tools and knowledge to look at the code client side.

a possible solution : do the whiz-bang serverside, and only send innocuous html to the browser, php jsp perl instead of javascript.

in your code sample above, line 9 should be line 19.
<body> does not belong inside the <head>

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5</title>
<meta name="description" content="">
<style>
body {background: url(pics/paris.jpg) center top; background-size: 105% auto;}
</style>
</head>
<body oncontextmenu="return false">
<h3 align="center">Hello World</h3>
</body>
</html>

almostbob I do like you before but still the code is visible.

the code is visible.

And always will be.

Thanks pritaeas

You can disable the right mouse button to make it difficult of the not-so-advance user to see your code. But that's just a trik!

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.