FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Where;s better way using javascript link or write inside htm

 


Philip
Where;s better way using javascript link or write inside htm ?
I thought it's more good inside a html/php since
the code sometimes doesnt loaded when using link.
Ranfaroth
It's better to separate scripts from your (X)HTML page (like you separate style from content).
It's easier to maintain, it's faster to load for users (since they don't have to download it each time), and you'll avoid some IE bugs.
mariohs
yeah, separate the javascript from your (x)html... this is called unobtrusive javascript. Moreover, try to separate javascript (behavior), css (style) and html (content)... you'll have everything separated and clean...
also, take a look at the behavioral separation article from A List Apart...
Philip
oh isee thanks,
is there a way to encrypt the javascript files ?
yjwong
I guess there's no way you can encrypt javascript in just plain HTML. You could encrypt the code using PHP and output the code using PHP, but it is impossible to use one-way encryption and thus other people might still be able to steal your code.
Ranfaroth
Philip wrote:
is there a way to encrypt the javascript files ?
Just try to understand : if you encrypt your javascript files, the browsers won't be able to open it and tu execute the javascript code. Quite useless...
On the other hand : if the browser is able to read the javascript files, everobody can.
Philip
then is there a way to programming javascript hard to see the script ?
yjwong
There is no absolute way to prevent others from stealing your code. You can actually make the script hard to read for others (like dumping all your Javascript code into one line) but it will also make it hard for yourself to edit the script.
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.