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 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
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
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
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
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.
[...]
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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
|
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....
|
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...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
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...
|
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...
|
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...
|
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)...
|
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...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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...
| |