How Google and Facebook write javascript codes that are hard to read (view source)

Hi guys,

I wonder if I can achieve something like that too. Any idea for me to start my research?

Thanks

Something like the Google closure compiler will do this http://closure-compiler.appspot.com/home

thanks,
not understand this but will give it a try

Do you know server side code?

<?php

echo “var a,e,i,o,o;”

echo “function doSomething(){”
echo “alert();”
echo “}”

?>
Will output it all on one line
<%

response.write “var a,e,i,o,o;”

response.write “function doSomething(){”
response.write “alert();”
response.write “}”

%>
Is the same for ASP

In PHP you can use mod rewrite to keep using the .js extension.
Remember to set the headers for content type javascript. Each server language is slightly different. Browsers are different in automatically detecting js if the header is not put in.
You will also need to look in to cache headers too, as each browser acts differently, some even ignore the no-cache header completely. To get round this add a time variable to the URL when calling the server coded javascript