unreadable js code

A

alex

Hi all,

I'd like to find a way to make a part of my code unreadable from users when
they look at the source of my web page.
It is possible ?
I thought of using document.write(a_crypted_unreadable_string)... is it a
good idea ?
In fact, the code I want to make unreadable should generate html.

Thanks in advance,
 
V

Vladdy

alex said:
Hi all,

I'd like to find a way to make a part of my code unreadable from users when
they look at the source of my web page.
It is possible ?
I thought of using document.write(a_crypted_unreadable_string)... is it a
good idea ?
In fact, the code I want to make unreadable should generate html.

Thanks in advance,
One's desire to hide the source code is inversly proportional to its
quality.
 
E

Evertjan.

Vladdy wrote on 11 okt 2005 in comp.lang.javascript:
One's desire to hide the source code is inversly proportional to its
quality.

So true,
but a simple advice could be given,
though highly ineffective but for restraining the most casual visitor.

Use an external jscript:
<script type='text/javascript' src='mySillySecret.js'></script>

This answers the OQ perfectly,
the page root wouldn't show the code at all. ;-)

It could.
However that html could be read pasting and using the IE command line:

javascript:alert(document.documentElement.outerHTML)
 
D

Douglas Crockford

I'd like to find a way to make a part of my code unreadable from users when
they look at the source of my web page.
It is possible ?
I thought of using document.write(a_crypted_unreadable_string)... is it a
good idea ?
In fact, the code I want to make unreadable should generate html.

Understand that nothing can be hidden from the person who is capable
of understanding and exploiting your code. a_crypted_unreadable_string
is the really bad idea.

The only thing that works is to unplug your server. Every other
technique to hide your code will fail. There is no point in doing
things that fail. Focus instead on things that succeed.

http://www.crockford.com/javascript/jsmin.html
 
E

Evertjan.

alex wrote on 11 okt 2005 in comp.lang.javascript:
thank you !

Thank who?

This is usenet, do please quote to establish what and who you are
responding on or to.

Many are reading and the connection to the older posting is not available
to everyone.
 
A

alex

Evertjan. said:
alex wrote on 11 okt 2005 in comp.lang.javascript:


Thank who?

This is usenet, do please quote to establish what and who you are
responding on or to.

Many are reading and the connection to the older posting is not available
to everyone.

I meant thank you Evertjan.
 
S

Stephen Chalmers

alex said:
Hi all,

I'd like to find a way to make a part of my code unreadable from users when
they look at the source of my web page.
It is possible ?

Of course it's possible; I come across it all the time. Just copy the layout of
the poorer code examples posted on here. In fact the more of a beginner
you are, the easier you should find it.
 
A

alex

Stephen Chalmers said:
Of course it's possible; I come across it all the time. Just copy the layout of
the poorer code examples posted on here. In fact the more of a beginner
you are, the easier you should find it.
well... I didn't really get your piece of advice.
could you precise a little more ?
 
S

Stephen Chalmers

alex said:
well... I didn't really get your piece of advice.
could you precise a little more ?

So much of the code that one encounters is soo poorly laid-out that it would be
classed as unreadable, which is what you requested.
 
A

alex

Stephen Chalmers said:
So much of the code that one encounters is soo poorly laid-out that it would be
classed as unreadable, which is what you requested.

Ok, I'll try my best to produce the worst js code ever ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top