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

  • Home
  • SEARCH
  • 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 4064242
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:49:47+00:00 2026-05-20T15:49:47+00:00

While doing development on a .js file I’d like to just refresh that file

  • 0

While doing development on a .js file I’d like to just refresh that file instead of the entire page to save time. Anyone know of any techniques for this?

  • 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-20T15:49:47+00:00Added an answer on May 20, 2026 at 3:49 pm

    Here is a function to create a new script element. It appends an incremented integer to make the URL of the script unique (as Kon suggested) in order to force a download.

    var index = 0;
    function refreshScript (src) {
      var scriptElement = document.createElement('script');
      scriptElement.type = 'text/javascript';
      scriptElement.src = src + '?' + index++;
      document.getElementsByTagName('head')[0].appendChild(scriptElement);
    }
    

    Then in the Firebug console, you can call it as:

    refreshScript('my_script.js');
    

    You’ll need to make sure that the index itself is not part of the script being reloaded!

    The Firebug Net panel will help you see whether the script is being downloaded. The response status should be “200 OK” and not “304 Not Modified. Also, you should see the index appended in the query string.

    The Firebug HTML panel will help you see whether the script element was appended to the head element.

    UPDATE:

    Here is a version that uses a timestamp instead of an index variable. As @davyM suggests, it is a more flexible approach:

    function refreshScript (src) {
      var scriptElement = document.createElement('script');
      scriptElement.type = 'text/javascript';
      scriptElement.src = src + '?' + (new Date).getTime();
      document.getElementsByTagName('head')[0].appendChild(scriptElement);
    }
    

    Alexei’s points are also well-stated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While doing normal day-to-day Android development, is it safe to assume that hook methods
I've been doing ASP.NET development for a little while now, and I've used both
A long while back I transitioned to doing all my web application development in
I've just installed the 3.5 .NET Framework and while doing some cleaning I've notice
I'm doing a basic homework assignment which looks like this: While input <> -1
After doing web development for quite a while, I am faced with a new
How does PHP handle client connection while doing sleeps? Or put another way ...
I am fairly new to programming and while doing a lot of reading this
I've used strpbrk() occasionally while doing low-level string work in C, but I've never
A while ago I was trying to figure out a way of doing this

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.