The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> JavaScript Development
|
javascript sourcecode compression
Discuss javascript sourcecode compression in the JavaScript Development forum on Dev Shed. javascript sourcecode compression JavaScript Development forum discussing JavaScript and DHTML, AJAX, and issues such as coding cross-browser JavaScript.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

August 7th, 2001, 10:21 AM
|
|
Junior Member
|
|
Join Date: Aug 2001
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
javascript sourcecode compression
for not reinventing the wheel ... is there an out-of-the-box library for
compressing javascript sourcecode (probably utilising huffman encoding w/ a
dictionary optimised for javascript sourcecode) and doing the decompression
in javascript?
the task is obvious: crunch sourcecode consisting mainly of function()
declarations, store the resulting string in [wherever], download the whole
enchilada through j(ava)script, decompress it, and use eval().
can anyone point me to some useful resources? any help is appreciated.
- niko
|

August 8th, 2001, 12:32 AM
|
|
Contributing User
|
|
Join Date: Apr 2001
Location: New York
Posts: 122
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
hombre:
I'm not sure what your need is, but if you have need to compress your scripts, you can compress a .js file using any old jar utility (available with any java development kit) from the command prompt.
You can then reference the compressed file in the same manner that you would reference any external .js file:
<script src="your_compressed_file.jar"></script>
You can manually unjar the file to edit it, but there's no need (or ability for that matter) to uncompress it in your scripts.
Hope this was helpful.
|

August 8th, 2001, 07:55 AM
|
|
Junior Member
|
|
Join Date: Aug 2001
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
need different technique
szarecor:
thanks for you hints.
so far i understand that .jar files are a way to store, eventually compress javascript source files, probably sign them, and let the browser do the uncompression/installation (if that is an applicable term) of the resulting file.
now, what i'd rather need is a technique which allows me to compress sourcecode and leave the compressed file in a way not too easily understandable by the average script ripper.
you see, the point is: i'm currently developing quite a huge javascript application (> 40kb w/o comments, unnecessary whitespace stripped), divided into separate libraries, each one loaded on demand (not by a <script> tag but using a different technique). the library code will be dispersed among a bunch of additional resource files (images etc.) with an extension other than .js
that means : compression + obfuscation ;o)
as i'm putting quite a heavy effort into building the application, i'm also aware of the fact that a skilled js-programmer will be able to get a clue of what's going on and extract the full code, no matter what the 'protection' is.
for that reason, i'm looking for some sort of compression which (a) provides c/c++ routines for doing the encoding in a win32 application, and (b) provides j(ava)script routines for decoding the stream.
- niko
|

August 9th, 2001, 12:05 AM
|
|
Contributing User
|
|
Join Date: Feb 2001
Posts: 81
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|

August 9th, 2001, 02:39 AM
|
|
|
|
Are you willing to wait?
__________________
 Michael
|

August 9th, 2001, 02:45 AM
|
|
Contributing User
|
|
Join Date: Feb 2001
Posts: 81
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
Also, jar files are typically used for Java not JavaScript. Keep in mind these are two totally different languages. I can't imagine any scenarios where you would put JavaScript files into a .jar file.
|

August 9th, 2001, 03:16 AM
|
|
|
|
What about signing scripts?
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|