Hi,

> As I don't want the whole code to be visible to everyone, I tried
> splitting the HTML from the Javascript.

That doesn't change anything, anyone who wants to see it can still see
the JavaScript.  They have to look a *little* harder, but it's trivial
to look at the HTML, see the script tag with the src in it, and figure
out the URL to that file.  If you want to spend time doing web server
config, you can prevent requests for that file that don't have the
"referer" set to the HTML file it's in, but that just brings its own
trouble and eats time better spent doing something else.

> Would someone please be able to point me out what's the problem or an
> other way to hide Javascript?

I don't see any problem with what you have provided script.js is where
it needs to be and contains exactly what you used to have within the
script tag in the HTML.

But again, you can't hide the JavaScript.  You can obfuscate[1] it,
but if the code is delivered to the browser (which it has to be to be
run), then the end user can see it if they want to.

[1] http://en.wikipedia.org/wiki/Obfuscated_code

FWIW,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Jul 15, 9:07 pm, "[email protected]" <[email protected]>
wrote:
> Hi,
>
> I nearly finished a project which heavily use Script.Aculo.Us's
> effects and sliders. Everything worked fine.
> I have eveything into an index.html file, execpt the CSS stylesheet.
> As I don't want the whole code to be visible to everyone, I tried
> splitting the HTML from the Javascript. I created a file Index.php and
> put all the HTML in it and a file called script.js where all the
> Javascript is.
>
> Since I made this change, the sliders doesn't work anymore (can't be
> slided).
>
> Would someone please be able to point me out what's the problem or an
> other way to hide Javascript?
>
> Index.php starts with:
>
> <?php
> $to_print .= <<<HTML
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml";>
> <head>
> <meta http-equiv="content-type" content="text/html;
> charset=iso-8859-1" />
> <script src="prototype.js" type="text/javascript"></script>
> <script src="scriptaculous.js?load=effects,slider" type="text/
> javascript"></script>
> <script type="text/javascript" src="script.js"></script>
> <style type="text/css" media="all">@import url(style.css);</style>
> </head>
>
> <body>
>
> ... And end with:
>
> </body>
> </html>
>
> HTML;
>
> print $to_print;
>
> ?>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to