Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6195151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:25:07+00:00 2026-05-24T03:25:07+00:00

I have a js file and a gzipped version of this js file. The

  • 0

I have a js file and a gzipped version of this js file.

The problem I am facing is trying to serve the gzipped version of this js file to the browsers that support it.

I don’t know how to do that. If I add the js.gz to the current script element then it is not loaded and gives error.

How can I automatically serve the gzipped version of this js to the supported browsers.

Also I would like to restrict the gz serving the the folder /resources/widget/

I don't want to compress on the fly as i have around 1000 requests per second and it would take minutes to take down the server. Each js file is about 100KB and js.gz is about 16KB, so I would appreciate if I could be helped with my current files.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:25:08+00:00Added an answer on May 24, 2026 at 3:25 am
    RewriteEngine on
    RewriteCond %{HTTP_USER_AGENT} “.*Safari.*” [OR]
    RewriteCond %{HTTP:Accept-Encoding} !gzip
    RewriteRule (.*)\.jgz$ $1\.js [L]
    
    AddType “text/javascript;charset=UTF-8″ .jgz
    AddEncoding gzip .jgz
    

    rename your files from .gz to .jgz

    OR use

    <FilesMatch "\\.js.gz$">
      ForceType text/javascript
      Header set Content-Encoding: gzip
    </FilesMatch>
    <FilesMatch "\\.js$">
      RewriteEngine On
      RewriteCond %{HTTP_USER_AGENT} !".*Safari.*"
      RewriteCond %{HTTP:Accept-Encoding} gzip
      RewriteCond %{REQUEST_FILENAME}.gz -f
      RewriteRule (.*)\.js$ $1\.js.gz [L]
      ForceType text/javascript
    </FilesMatch>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gzipped text file that I'm trying to read within PHP (using
Suppose that we have file like this: sometext11 sometext12 sometext13 sometext21 sometext22 sometext23 Texts
I have some code that downloads gzipped files, and decompresses them. The problem is,
I have this program that takes one argument for the source file and then
I have a web service that serves a javascript source file to browsers. The
I am a python newbie here... I have a gzipped file (C:\sample.gz) that I
I'm trying to pull a gzipped json file from http://api.discogs.com/release/339901 . I have https://github.com/waveto/node-compress
I have file to edit that contains: Categories, Diamond,10,11, Coal,21,21, How to add string
Suppose I have file which goes like this : a void measure() { a
I have a class that reads a file of a particular format. These files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.