473,396 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

refreshed script

Hi,

Is there a way to force the browser to use the fresh script from the
website instead of reading the cached .js file. I have the same
question for the HTML code for that matter. Any meta tag, attribute,
that will make the browser to get the updated page from the webserver
instead of what was cached.

TIA.
Jul 23 '05 #1
2 1022
Aamir Ghanchi wrote:
Hi,

Is there a way to force the browser to use the fresh script from the
website instead of reading the cached .js file.
Yes. Assuming Javascript is enabled.

I have the same question for the HTML code for that matter.

Same answer.
Any meta tag, attribute, that will make the browser to get
the updated page from the webserver instead of what was cached.


No, not with a meta tag.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 23 '05 #2
Aamir Ghanchi wrote:
Hi,

Is there a way to force the browser to use the fresh script from the
website instead of reading the cached .js file. I have the same
question for the HTML code for that matter. Any meta tag, attribute,
that will make the browser to get the updated page from the webserver
instead of what was cached.


Depending on how often your external JavaScript content changes, you can
do one of two things:

1) <script type="text/javascript"
src="myfile.js?v=200407081320"></script>

Then simply modify the value of the [v]ersion when "myfile.js" changes.
If you use "myfile.js" in multiple places, put the above code into
another file and server-side #include it in the pages you need. When
"myfile.js" changes, you upload it, modify the SSI that includes the
above syntax and upload it.

2) <script type="text/javascript">
document.write(
'<script type="text/javascript" src="myfile.js?v=' +
(new Date()).getTime() +
'><\/script>'
);
</script>

(or you can use server-side code to do the same thing)

This will result in "myfile.js" being downloaded with each visit to the
page, which sort of negates the benefit of using an external JavaScript
file.
I use the first concept a lot, an external JS file with a SSI to include
it on pages. It is the easiest to maintain and guarantees everyone gets a
fresh copy only when I actually change something.

You can also control caching behaviour from your server: <url:
http://www.mnot.net/cache_docs/#CONTROL />

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: anonieko | last post by:
Scenario: You have a page that is TOO slow to refresh. But it allows partial flushing of html contents. I.e. Submit button already appears but you don't want your users to click on it prematurely...
1
by: abdul bari | last post by:
Hi I have a standard html form which is generated by an XSL sheet. The form data is submitted to the server and is passed on to file.aspx for processing. However file.aspx is refreshed every 5...
5
by: Bill Cohagan | last post by:
I'm constructing an ASP app with a frameset on the home html page. From frame A I need to referesh the page in frame B when a button click occurs on a button in Frame A (server side event handler)....
3
by: Chad Grooms, MCSD | last post by:
Here's an issue I haven't seen before now, and I am wondering if anyone else has experienced this... I have an web application (asp.net,vb) that has worked fine for quite a while. Now, For some...
4
by: SSS | last post by:
Hello there, My problem is that I have a page which is displaying 4 real time data values which are being refreshed every one minute. On the same page I have other text boxes where user enters...
0
by: arunprabu | last post by:
Hi, I have a problecm with the AJAX request in my webpage. I have some filters on top of the page. I have a submit button and an empty div below the filters. Some of the filters have ajax...
13
by: frozenade | last post by:
dear all.. I try an upload script from: http://www.phpletter.com/uploaded/projects/ajaxfileupload/ajaxfileupload.zip in online demo page, it's ok, but when I downloaded it and try to localhost,...
3
by: Mythilisg | last post by:
hi, i'm working in asp.net with c#. i hav one dropdownlist with some options which is similar to Security Questions in yahoo mail. I hav one option called "If Others". When the user selects this...
1
by: anudu | last post by:
Hi, I have several update panels in my page. i want to call different javascript methods after the update panels are refreshed . i have attached the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.