Compress Some Files Using Gzip/deflate?

Feb 3, 2009

I want to compress some javascript files using gzip/deflate.

The thing I worry about though is browser support. In my searches, I've seen some suggestions that some older browsers will send the http Accept-Encoding: gzip header, but they aren't actually capable of using a compressed javascript file.

I've seen various solutions which try to sniff the browser via the user_agent header and just serve the uncompressed version when it thinks the browser is gonna choke on it. But the sniffing examples I've seen seem to vary a lot, and I worry they aren't very good.

For example, look at the sample provided by the apache manual [URL] Used as-is, that's gonna catch opera and serve it an uncompressed file, when opera will handle it just fine. And I've also seen people say safari(which versions I'm not sure) doesn't like compressed javascript either, but I don't see anything in the example provided by mod_deflate that would save safari from doom.

Many of the webpages I've come across on this subject seem outdated or incomplete, which doesn't do much for my confidence.

What do you do? Part of me want's to just give these buggy browsers what they ask for when they say they accept gzip/deflate and let them explode....but I think there's still too many users of these older browsers to just do that. I feel I should make a good faith effort to try to make it work reasonably well. This seems like a very realistic issue and I'm somewhat suprised I'm not finding more information on it.

View 3 Replies


ADVERTISEMENT

Remote Does Gzip Still Work?

Feb 5, 2009

I am writing a javascript based tool that other people can call on their webpages. I was wondering if I have gzip enabled on my server and they call my javascript file will it still have the benefits of gzip or will the fact it's being called remotely cause a problem.

The reason I ask is because the file is 54kb normally and 18kb when gzip is enabled on the server.

View 2 Replies View Related

JQuery :: Initial Setup - What File To Install On My Server If Don't Have GZIP Available

Jul 3, 2009

Cannot get jQuery to work (unless I access [url])

Is this permissible, or do I have to download jquery.js to my server? If not, I have other questions:

- My hosting service does doesn't have gzip compression enabled --what file do I need to install on my server if I don't have GZIP available?

- How can I extract that file (jquery.js?) from jquery-1.3.2.js.txt? (looked for GZipper, but from what I can see that's Mac s/w and I'm running windows)

View 7 Replies View Related

Compress A File Using Script?

Oct 2, 2010

Would like to test for the file size of a file. If file is over 20 MB I would like to use some javascript to compress the file.

View 1 Replies View Related

Compress Text On Server, Decompress On Client Using JavaScript?

Mar 29, 2006

I'm new to JavaScript. I have relatively large amounts of text (~200 kB) that I need to transfer to my web application every now and then. Using RAR, I get a 5:1 compression ratio on these files, for example one of 180 kB is compressed to 34kB.

Is there some standard way to decompress files in JavaScript?

View 1 Replies View Related

Serving Up Compress Pages Without Access To Server Side Tools?

Jul 23, 2005

I have a website with no ssi, php, cgi...nothing. Plain old flat pages are all it serves.
I need to upload a list to it - a big, plain text list in html. A 2Mb list!

With gzip compress, it comes down to 91Kb, much more modem-friendly!

After about 30 minutes of googling, I haven't yet found a way of serving this page up like this.
I can't send headers as no php or .htaccess is allowed.

And please don't suggest I move to a "proper" web host! It's for a friend with a one-off need for a small website for about 2 months, and the freebie 10Mb is fine.

View 3 Replies View Related

Mail Service - Attach Some Excel Files Of Text Files And To Send It

Aug 16, 2010

I have designed a mail service in java.In my compose page,i want to attach some excel files of text files and to send it.After sending i want to store it my database.Then how can i download or open that file after opening that recipient mail inbox.

View 1 Replies View Related

XMLHttpRequest Script - Works For Local XML Files But Not For External XML Files?

Oct 2, 2010

I have the following JavaScript (see below). The script requests an XML file from the server and displays it on the page.The script works fine when the requested XML file is stored on the same server as the script.The problem is when I try requesting an XML file from an external server such as the National Weather Service. I get an error. If I take the XML file from the National Weather Service and save it to my server it works. Why can't I use my script to request XML files stored on external servers?

Javascript Code

Code:

window.onload = initAll;
var xhr = false;
function initAll() {
document.getElementById("makeTextRequest").onclick = getNewFile;

[code]....

View 6 Replies View Related

JQuery :: Ajax Request Works With .xml Files But Not .php Files?

Aug 27, 2010

In my quest to implement ajax for the first time i've hit a brick wall. i've been searching for hours for a solution but with no success. Here is the problem.

[Code]...

why is it not working? my PHP code is outputting the contents of the xml document.

View 1 Replies View Related

List All Files In A Folder Including Subfolder Files?

Sep 5, 2008

I want to write a javascript to list of all files in a folder including files in the subfolders. This is for the scorm purpose to list all the files. some examples are listing files but not listing the files inside the subdirectories. I want the file's full path like C:Documentsjavascriptwilson.js like this.

View 5 Replies View Related

Diving Into Regexp By Porting A Perl Script Over To Js That Uses Regexp To Compress Into A Bookmarklet Capable Format?

Aug 10, 2010

I'm finally diving into regexp by porting a perl script over to js that uses regexp to compress javascript into a bookmarklet capable format.I've successfully worked out 90% of the expressions but am troubled with a few, this one at the moment is odd:I want to remove the first line if it hasjavascript:So I thought str.replace(/^javascripts+:s+/, "") would be ok. I want javascript text, any space, colon, any space and new line. what I'm doing wrong.btw this is the original perl version

$src =~ s{^// ?javascript.+:.+
}{};

View 3 Replies View Related

Show Images From Four Files - Each Files Are In Each Folder?

Jan 15, 2010

I have four folders and each folder has one images, let say ( images-one.jpg, images-two.jpg, images-three.jpg, images-four.jpg). now,in index.php page there are four buttons, each buttons for each images. if i clicked button numer two for images-two.jpg, and then it will show that images name from that folder in index.php page. and then if i reload same index.php page or refreshed same page, i want to show SAME images that I clicked before which is images-two.jpg. how can i write that code to show images from four files, each files are in each folder.

View 1 Replies View Related

Jquery :: Compress And Minify Scripts When I Have Multiple Scripts?

Jul 13, 2010

I would like to know better ways to compress and minify jquery scripts, if i have multiple scripts and some of them from the same author...can i simply copy and paste them into one file?

View 2 Replies View Related

Multiple Language Files - Use PHP Language Variables In Files?

Jan 9, 2011

What is the correct way to work with multiple language JavaScript files? So how to use your PHP language variables in your JavaScript files? The way I do it now is create JavaScript files like 'script_js.php' like this:

[Code]...

View 10 Replies View Related

How To Include Html Files In Html Files

Aug 27, 2009

The problem is, I might want to change the html I include based upon variables passed between web pages.My problem is I don't know how to include html files in html files using javascript! How would you do this?

View 1 Replies View Related

SWF Files

Jun 14, 2007

I have some Flash SWF games on my website with advertising banners on them.
People access a certain game by going to
http://www.mysite.com/flashgame.htm. With IE no problem. But in Firefox they
can type in http://www.mysite.com/flashgame.swf and bypass my banners. The
banners help pay for me hosting these games.

Is there a way with javascript that I can tell when they are going directly
to the swf file instead of going to the htm page? And redirect them to the
htm file?

View 6 Replies View Related

.eml Files To .xls

Jan 13, 2006

I need to change like 500 .eml files to .xls files.

Is this even possible?]

View 2 Replies View Related

How To Use Other Files In JS

Feb 6, 2006

In lets say I have an HTML document that has this in it:

<script type="text/javascript" src="file1.js"></script>
<script type="text/javascript" src="file2.js"></script>

I am trying to use a function that is defined in file 1 inside file 2. Its not working because its telling me that the function is undefined. Is there any way to make one file "see" the functions inside the other file in javascript?

View 5 Replies View Related

Writting Files

Oct 20, 2005

I have a question. Is it possible to write a text file using JavaScript?

View 2 Replies View Related

Posting To 2 Different Files

Apr 22, 2006

I have a form, which has a user and password, that a user enters

when i want to submit this form....

i would like to submit it to 2 two different files.

so file1.asp would have user and password....and file2.asp would have
user and password.

i would like two different windows to open, if possible. so the user
can work on both windows at once.

window 1 = file1.asp
window 2 = file2.asp

View 13 Replies View Related

Uploading Files With IE

Jul 29, 2006

I'm writing a class that will enable the user to upload files to
the server without reloading the current page (using target="iframe"),
and it works just fine in Firefox, but when I test it in IE, first of
all, the iframe is not targetted at all, and IE stupidly opens a new
window, second the <input type="file" element looses it's name
attribute for some reason... I tried using DOM and assigning the
element thru innerHTML, both will just not work in IE (and will just
fine in Firefox). Those interested to have the source code (commented
in french) may just ask me. But if anyone had similar problems, and
would want to share with me, I'd really much appreciate, because this
is driving me insane!

View 2 Replies View Related

Including Files

Aug 31, 2006

This seems like a really stupid question. Can you include a javascript
file in a javascript file?

Rather than doing this:

<script src="A"></script>
<script src="B"></script>

I want to do

<script src="A"></script>

and then have in script A:

include("B");

where include is a magic word that includes the file B.

View 1 Replies View Related

Files And Checksums

Jul 20, 2005

Is it possible to have JavaScript do a checksum of a file a user has
chosen to upload via a multipart html form? I'd like have JavaScript
do a checksum on the client side, embedded the result in the form, and
then have a CGI on the server check to ensure the server-side checksum
matches the client. Is such a thing even possible?

View 1 Replies View Related

Writing Files?

Jul 20, 2005

I there any way for javascript to write/manipulate a file other than through a cookie?

View 1 Replies View Related

Files With The .js Extension

Jul 20, 2005

I have recently bought the book: JavaScript & DHTML Cookbook. As I
opened the .js files with note pad, I asked myself why was the code
formated in such a way. The code looks as if it had been produced by
some kind of programs instead of a person. I also noticed a lot of
little squared zeros; what are those all about?

I have also noticed code formated in a similar way, when viewing some
of the source code of the web pages on the MSN web site. If someone
knows anything about this machine-like formating, I would love to hear
from you.

View 3 Replies View Related

Just One Of Several .flv Files Not Playing?

Jun 15, 2009

my website [URL] has been left unfinished by my friend and it doesnt look like he can finish it now. I have some understanding of code and have manually edited the existing pages in notepad to fix some issues. The one issue I have left is on the javascript samples player which overlays the main screen. I have all of the files (an flv and swf plus a folder full of js and a vbs file). As you will see, the morning chapter does not play but all of the others do. I have checked the flv in a player and it works fine, and it was created in the same way as the others. All flv and swf files are uploaded correctly I just can't work out why it is not working.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved