473,323 Members | 1,551 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Dynamic Javascript Obfuscator & compression Apache module?

I would like to obfuscate and compress (remove comments, newlines etc)
my javascript files / ajax code. Is there a module that will do this on
the
fly with some level of caching?

Does such a beast exist?

thx
Gupit

Mar 31 '06 #1
6 4784
Chetan Patil wrote:
I would like to obfuscate and compress (remove comments, newlines etc)
my javascript files / ajax code. Is there a module that will do this on
the
fly with some level of caching?

Does such a beast exist?

thx
Gupit


hi,

A bit off topic maybe, but I am curious why you want to obfuscate your JS.
For securitypurposes it is barely a serious option.

Erwin
Mar 31 '06 #2
Chetan Patil wrote:
I would like to obfuscate and compress (remove comments, newlines etc)
my javascript files / ajax code. Is there a module that will do this on
the
fly with some level of caching?


There seems little point in doing it on the fly - do it once, test it, then
publish. Why compress the JS file every single time? It will likely cause
the file to be not cached on the client.

Forget obfuscation, minification is good:

<URL:http://www.crockford.com/javascript/jsmin.html>
--
Rob
Mar 31 '06 #3

RobG wrote:
Chetan Patil wrote:
I would like to obfuscate and compress (remove comments, newlines etc)
my javascript files / ajax code. Is there a module that will do this on
the
fly with some level of caching?
There seems little point in doing it on the fly - do it once, test it, then
publish. Why compress the JS file every single time? It will likely cause
the file to be not cached on the client.


Same as for gzip compression on the fly - the server may keep the cache
but I think it does not keep gzip-ed versions of pages on persistent
storage. But different servers may act differently too.

Forget obfuscation, minification is good:

<URL:http://www.crockford.com/javascript/jsmin.html>
There is great compressor from Dean Edwards

http://dean.edwards.name/packer/

But again, the results may vary especially when using the mentioned
on-the-fly gzip compression.

As for the original poster - you do not need Apache module, the job can
be done by server script fetching the original JS file and obfuscating
(or even caching the obfuscated version).

Roman

--
Rob


Mar 31 '06 #4
Roman Ziak wrote:
RobG wrote:
Chetan Patil wrote:
I would like to obfuscate and compress (remove comments, newlines etc)
my javascript files / ajax code. Is there a module that will do this on
the
fly with some level of caching?
There seems little point in doing it on the fly - do it once, test it, then
publish. Why compress the JS file every single time? It will likely cause
the file to be not cached on the client.

Same as for gzip compression on the fly


I think they are quite different. Servers negotiate whether the client can
accept zipped files or not and may serve either compressed or uncompressed.
For minified JS files, the same file is sent to all clients so the
minified file should be created, tested and used as-is.

Further, a zipped file is much more robust and virtually guaranteed to be
identical when opened by the client. The zip/unzip and negotiation stages
can all be tested and verified, then applied to a general case. The
results of minification aren't, they must be tested by the individual site
and file and therefore can't be applied in general.

the server may keep the cache
but I think it does not keep gzip-ed versions of pages on persistent
storage. But different servers may act differently too.


Yes, in that respect they are the same but so is any cached data.

[...]
--
Rob
Apr 1 '06 #5
RobG wrote:
Roman Ziak wrote:
RobG wrote:
Chetan Patil wrote:

I would like to obfuscate and compress (remove comments, newlines etc)
my javascript files / ajax code. Is there a module that will do this on
the
fly with some level of caching?

There seems little point in doing it on the fly - do it once, test
it, then
publish. Why compress the JS file every single time? It will likely
cause
the file to be not cached on the client.

Same as for gzip compression on the fly


I think they are quite different. Servers negotiate whether the client
can accept zipped files or not and may serve either compressed or
uncompressed. For minified JS files, the same file is sent to all
clients so the minified file should be created, tested and used as-is.


This is good point.

I agree that it is a waste of machine time to do that upon every
request. However, with little more sophisticated script, it can do it
once and then only after the file changes again.
Further, a zipped file is much more robust and virtually guaranteed to
be identical when opened by the client. The zip/unzip and negotiation
stages can all be tested and verified, then applied to a general case.
The results of minification aren't, they must be tested by the
individual site and file and therefore can't be applied in general.
Removing comments and white spaces should not affect the javascript.
That's in theory and really depends on the quality of minifier. I did
not use Douglas' minifier, but Dean's packer never failed :)

the server may keep the cache
but I think it does not keep gzip-ed versions of pages on persistent
storage. But different servers may act differently too.


Yes, in that respect they are the same but so is any cached data.

[...]

Apr 1 '06 #6
Chetan Patil wrote:
I would like to obfuscate and compress (remove comments, newlines etc)
my javascript files / ajax code. Is there a module that will do this on
the
fly with some level of caching?

Does such a beast exist?

I would probably devide the ofiscation and compression into those
two tasks. If you google my posts on this subject you should find
an interesting cross browser approach to obfuscation.

As to compression , it's either process or pre-process.
If your maintaining a body of code , I'd suggest you avail yourself
of a Makefile and what I'm sure are many freely available and/or fairly
easily constructed script compressors to produce what will be am easily
cached file.

If your dynamically constructing code from multiple servers and
databases I'd need more data to properly answer your query

Apr 5 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Perttu Pulkkinen | last post by:
I tried to install php as apache module. Previously it has been cgi. WIn 98 is not supported but cgi worked fine, anyway. I tried to everything according to instructions in php.net, but still...
1
by: George Adams | last post by:
I like the idea of compiling DSO modules for Apache. It allows me to turn on or off things we may or may not need at a given time (like mod_ssl, mod_auth_mysql, mod_auth_ldap, etc.) and also...
19
by: Nancy | last post by:
Hi, When I start my PC(winXP Pro), it always says: Unknown(): Unable toload dynamic library './php_msql.dll' - The specified module could not be found. Then my Apache servre starts, load php...
6
by: cool2005 | last post by:
I have been trying several JS obfuscator but none of them work with a set of JS files. There are references between files so it will never work if the JS obfuscator process each file...
20
by: korund | last post by:
I want encrypt javascript code in web page, however, browser need fully recognize it.. There any many Javascript Obfuscators in the Net. Is there some good and handy utility(or script) among them...
20
by: twigster | last post by:
Hey everyone, I'm looking for a good way to obfuscate some Javascript code. Does anyone have a good experience or bad experience with a particular software? thanks
1
by: zpinhead | last post by:
I am unable to get my downloaded extension from pecl to link up with php properly. seems like the php.so I could not use pear install http. pear claimed the extension was already installed....
28
by: Peter Michaux | last post by:
Hi, I'm playing with dynamic script insertion to make a request to the server for a JavaScript file to be automatically run when it arrives in the browser. It works but... The page caching...
11
by: =?iso-8859-1?q?Martin_M=FCcke?= | last post by:
Hi, I am looking for a good javascript obfuscator - I found several on the web, but I am looking for one that can also handle javascript in jsp, html and java files - so I need a javascript...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.