Helpful Information
 
 
Category: System Administration
How can i hide the html source code from the browser view source??????

Hello,

i thought i should post first question in this forum.


tell me how can i hide the source code from browsers."viewsource" option should not be activated in browser menu.

thanku






------------------
SR -
shiju.dreamcenter.net (http://shiju.dreamcenter.net)

Technically, you can't. The client has to receive the HTML to display it. You can try to hide it using frames, but some browsers offer the option to view frame source. Also, a savvy user will know how to get at the source even if you use frames.

I would agree with Rod, that technically
you can't, but depending on your goal in
hiding the code, maybe you can have the next
best thing.

You could:

(1) Build the page with Flash.

(2) Build the page entirely with javascript
in a .js file and then call the .js
file from your HTML.

(3) Once you get the page the way you want
it, you could run the HTML through a
script that would remove all the carrige
returns, thus putting all the code on
one (very long) line.

There are probably dozens of other creative
methods for obscuring your source, but keep
in mind that most pages need maintenance at
some point, and you'll probably only be
making your own life miserable. http://www.devshed.com/Talk/Forums/smile.gif

Scott

<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>(2) Build the page entirely with javascript
in a .js file and then call the .js
file from your HTML.[/quote]

How does that help if I may ask?

Well, the source code would then look something like:

<HTML>
<SCRIPT LANGUAGE="javaScript" SRC="file.js">
</SCRIPT>
</HTML>

Thus providing another layer of obsurity
that the interested code hunter will have to
traverse to get to the "real" code.

Not to mention that the code
wouldn't be terribly easy to work with if
it was all encapsulated in document.write()
statements.

Also, I'm not sure if it would work, because
I'm not really a big fan of js, but you might
even be able to put the .js file somewhere
that isn't "web readable" thus completely
hiding the "real" source.

Scott

How about using java applet for hiding sourde?

Scott, you really need to have the .js file web readable (so not secure), because it's being evaluated (being read and run by the browser).

ads, How? http://www.devshed.com/Talk/Forums/smile.gif

And btw.. What's the idea of this conversation anyway? Hiding source-code isn't really important, is it? :-)

I wasn't sure about tucking away the .js
file, but I know that sort of thing works
with my mySQL passwords, so I figured maybe.

As for the Java applet, unless you take the
time to reverse engineer it, any code in
there is pretty safe. I have known people
that have done just that though, so nothing
is truly safe. http://www.devshed.com/Talk/Forums/smile.gif

As for "why this conversation", I don't know.
My code isn't all that special, but I guess
Shiju Rajan feels differently. http://www.devshed.com/Talk/Forums/smile.gif

Scott

Hello,

tell me, how these site is hiding view source..
http://www.careercity.com/


Thank you all for participating this conversation



------------------
SR -
shiju.dreamcenter.net (http://shiju.dreamcenter.net)

I have no idea what you mean. I can view the HTML source fine.

Uhh.. Blank page.. How about scrolling down? http://www.devshed.com/Talk/Forums/smile.gif

------------------
---
Dist - dist@clan-station.org - Founding member of Clan Station (http://www.clan-station.org)

Here is a solution..
It will work via a form POST, but the html source of your index page probably won't work. If you get this idea, of course, you can replace the form button with image or whatever.
# the form page
<html>
<body>
<form method="POST" action="hide.pl">
<input type=submit>
</form>
</body>
</html>

# the result page
<html>
<meta http-equiv="Pragma" content="no-cache">

<body>
<h1>Hide Source</h1>
</body>
</html>

# the hide.pl script
#!/usr/bin/perl

print "Content-type: text/htmlnn";
open (HIDE, "hide_source.html");
@lines = <HIDE>;
chomp @lines;
print "@linesn";
close(HIDE);

#viewing the result
This document resulted from a POST operation and has expired from the cache. If you wish you can repost the form data to recreate the
document by pressing the <b>reload</b> button.

I can understand the reason for wanting to block the code - I'm having problems with someone stealing my code. It's an event schedule listing that took quite a bit of work and contacts to compile. They took the list, coded exactly the same, right down to the fonts and format.

I think I'll try that "blank looking" code, maybe it'll fool them. It fooled me until you pointed it out. A question - would all the blank lines ad to the size of the page?

Thanks!

>>would all the blank lines ad to the size of the page?

A blank line is equivalent to a newline (i.e. n). It will increase the size of your page.

Opening a new text document and press ENTER once, then save this document, its file size will not be 0 byte.

You can stop VIEW SOURCE quite nicely in most PC browsers using :

function click() { if (event.button==2) { alert('Bad Luck Sonny'); }}

Note that if the viewer disables Javascript this won't work. Also, Mac browsers don't have a button 2 !

Hello All!

I may be wrong, but has anyone considered using JavaScript's window properties to disable most options in the user's browser? Does "menubar" also disable the view source button? This (below) would cripple the user's options (hopefully including "view source"):

self.menubar.visible=false; <-- most important
self.toolbar.visible=false;
self.locationbar.visible=false;
self.personalbar.visible=false;
self.scrollbars.visible=false;
self.statusbar.visible=false;

Hope this helps!
yoshi
datera@datera.com http://www.datera.com

None of this prevents someone from getting the resultant HTML. It can't be done. You may prevent them from using some easy methods to get the HTML, but in the long run if you want people to be able to see your pages then anyone can get the data.

Why hide the source, afterall the Internet should be a shared and free resource for everyone, who wants to be Microsoft and copywrite the behaviour of the computers? That is just like copywriting oxygen.

I can understand that your own source code is your own work, but html tags can be found on many sites that are tutorials for html. However, the source codes are an excellent guide for improving your website and only idiots would copy the code exactly for their site.

You CAN hide the source, with mysql, I seen it my self,.....

------------------
SwEdE[oelbal]n

No, you can't. Read the topic again. HTML is parsed and displayed by the browser. You can't hide it from the browser because if you did the browser couldn't display it.










privacy (GDPR)