HighDots Forums  

Refreshing .js files

Javascript JavaScript language (comp.lang.javascript)


Discuss Refreshing .js files in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
MartinRinehart@gmail.com
 
Posts: n/a

Default Refreshing .js files - 08-24-2008 , 01:15 PM






I've got the usual suspects on KDE: Firefox, Konqueror and Opera. All
aggressively cache .js files. I've not figured out a way to remove a
cached .js without closing the browser and restarting it.

This makes them useless while coding .js files. My solution (kludge?)
is to leave what will become .js between <script> </script> tags in
the HTML until it feels like it is fully-featured and totally debugged
and then move it into a .js. As "fullly-featured and totally debugged"
is a rare condition, I've got more JavaScript in HTML than in .js,
where it belongs.

Is there a better way? A browser smart enough to compare time stamps
and reload .js as necessary?

Reply With Quote
  #2  
Old   
optimistx
 
Posts: n/a

Default Re: Refreshing .js files - 08-24-2008 , 01:30 PM






MartinRinehart (AT) gmail (DOT) com wrote:
Quote:
Is there a better way? A browser smart enough to compare time stamps
and reload .js as necessary?
Why not
<script src="something.js?x='+(Math.random())' ...
?




Reply With Quote
  #3  
Old   
Joost Diepenmaat
 
Posts: n/a

Default Re: Refreshing .js files - 08-24-2008 , 02:39 PM



MartinRinehart (AT) gmail (DOT) com writes:

Quote:
I've got the usual suspects on KDE: Firefox, Konqueror and Opera. All
aggressively cache .js files. I've not figured out a way to remove a
cached .js without closing the browser and restarting it.

This makes them useless while coding .js files. My solution (kludge?)
is to leave what will become .js between <script> </script> tags in
the HTML until it feels like it is fully-featured and totally debugged
and then move it into a .js. As "fullly-featured and totally debugged"
is a rare condition, I've got more JavaScript in HTML than in .js,
where it belongs.

Is there a better way? A browser smart enough to compare time stamps
and reload .js as necessary?
Firefox, at least, will refresh all files when reloading using
SHIFT+CTRL+R and SHIFT-F5. I also suspect (but I haven't tested this
explicitly) that setting some aggressive non-caching headers should
make refreshing work on recent versions of all these browsers. And you
probably should do that during development anyway.

http://www.w3.org/Protocols/rfc2616/...4.html#sec14.9

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/


Reply With Quote
  #4  
Old   
Dr J R Stockton
 
Posts: n/a

Default Re: Refreshing .js files - 08-24-2008 , 02:56 PM



In comp.lang.javascript message <a7a73088-8603-4ead-aeab-a754394dea21@k7
g2000hsd.googlegroups.com>, Sun, 24 Aug 2008 10:15:24,
MartinRinehart (AT) gmail (DOT) com posted:
Quote:
I've got the usual suspects on KDE: Firefox, Konqueror and Opera. All
aggressively cache .js files. I've not figured out a way to remove a
cached .js without closing the browser and restarting it.

This makes them useless while coding .js files. My solution (kludge?)
is to leave what will become .js between <script> </script> tags in
the HTML until it feels like it is fully-featured and totally debugged
and then move it into a .js. As "fullly-featured and totally debugged"
is a rare condition, I've got more JavaScript in HTML than in .js,
where it belongs.

Is there a better way? A browser smart enough to compare time stamps
and reload .js as necessary?
Try writing the '<script type="text/javascript" src="...js"></script>'
with 'document.writeln', but appending to "...js" '+ +new Date()'. That
might defeat the caching.

Or write a utility to rename the ...js file and change the reference to
it correspondingly.

I assume you've tried shift-reload or similar?

Or run a Windows emulator with a Windows browser in it.

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links;
Astro stuff via astron-1.htm, gravity0.htm ; quotings.htm, pascal.htm, etc.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.


Reply With Quote
  #5  
Old   
MartinRinehart@gmail.com
 
Posts: n/a

Default Re: Refreshing .js files - 08-26-2008 , 05:22 PM



Thanks, all, for the suggestions. Reading them I went back to Windows
where I learned the FF Windows is NOT FF KDE. Didn't take much
fiddling to get FF Win to reload. FF KDE has not yielded to fiddling.
Looks like a utility to rename the .js and edit the new name into the
HTML is called for. (I really DON'T want to return to a single-desktop
OS.)

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.