Click to See Complete Forum and Search --> : hide view source..?


asoekaya
07-28-2008, 11:59 PM
hello all...
iam new here and iam stll beginner...
so i want ask you all.. how can we hide our website source ...??
i mean when someone click on view source it will not appear the script....

thanks..

bradgrafelman
07-29-2008, 01:05 AM
Moved to ClientSide Technologies.

You can search Google for some Javascript that will disable the right-click menu and try to hide the source, but ultimately the answer is: you can't. You have to send the HTML source to the browser so that it can parse and display the page. There's no way to tell all of the browsers out there to keep it all a big secret, though.

JLoima
07-29-2008, 01:14 AM
Hi!

Another way is to play with frames, so most browsers will show only source of the main frame-page...

But anyway, reality is that soure has to be sent to client computer so you cant hide it. And why do that? As long as google exists, there are no coding-secrets! :)

If you are embedding some critical data to source for example in hidden inputs You sould probable consider some other way for moving secret data.

devphp12
07-29-2008, 01:22 AM
you can use this script.
hope so its working in all browser which support javascript
it working in IE.


<script language=JavaScript>
<!--

//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

var message="Click Disabled!";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")

// -->
</script>

Weedpacket
07-29-2008, 01:43 AM
Hi!

Another way is to play with frames, so most browsers will show only source of the main frame-page... Well, any decent browser that offers "view page source" would at the same time offer "view frame source"....




function clickIE4(){
...
function clickNS4(e){

Hello? 1997 just called. They want their code back.

NogDog
07-29-2008, 08:24 AM
All those JavaScript things do is disable the right mouse click context menus (and even that won't work if the browser is configured to not allow that type of function, such as mine). And even if the right click menu is disabled, the user can still use the browser's menu bar options to do the same thing.

Ultimately, all the various shenanigans you come up with to try to hide your page source will at best only stop the the non-web-savvy from viewing it, and they are the least likely ones to actually want to view your source or be able to make any sense of it if they did.

The web is about sharing. If you don't want to share it, don't put it on the web.

rulian
07-29-2008, 10:03 AM
Yup, dont even try it, even if you keep your files key protected and ajax them in so that their original code never opens, users can always use firebug which simply displays all active scripts reguardless of how they are loaded in a very pretty format.

Client side means its on the person's computer, and if its on their computer they can see it.

bpat1434
07-29-2008, 11:54 AM
Theoretically you could create a javascript "parser" which you send your html to and the javascript in turn writes it to the document. Alternatively you could use AJAX and require javascript to write everything on result of an initial AJAX query.

Not the best way to go because extensions like Firebug will make visible the HTML even if it's hidden/created with javascript conventions.

Weedpacket
07-29-2008, 10:08 PM
Not the best way to go because extensions like Firebug will make visible the HTML even if it's hidden/created with javascript conventions.Not to mention the fact that it opens up a whole 'nother source of bugs and accessibility problems. And don't expect it to help your page rank much, either!

Roger Ramjet
08-01-2008, 09:06 PM
And what exactly are you trying to hide anyway? Believe me, there is nothing that you are going to be able to do with HTML/CSS that has not already been done a thousand - no, a million times already.

If it is your design/content, then, depending on where you live, that is already protected by copyright/intellectual property laws.