tags:

views:

61

answers:

3

I do not really understand how Google Code handles file versioning. I am building a jQuery plugin that anyone can access. Like so:

<script type="text/javascript" src="http://jquery-old-browser-warning.googlecode.com/files/jquery.browser-warning.js"&gt;&lt;/script&gt;

This script accesses other files on the same project (via ajax).

The problem is, that when I upload a new file, it just seems like there aren't any changed to it. Google recommends that new files should have new names. But then I would have to change the filenames that the script loads. But then I would have to change the script file as well, and that would break everybodys implementation (with the script-tag above)

Is there a way to force a file to change when uploading with the same filename?

PS: If I go directly to the project page's file list. Then I do get the file with the updated content. But as I said, not when getting it through ajax.

+2  A: 

The cheapest trick in the book to prevent caching is adding some random content to a GET parameter:

www.example.com/resources/resource.js?random=1234567

You can for example use the current timestamp for this.

This, however, causes any and every access to re-fetch the content, and invalidates any client-side caching mechanism as well. I would use this only as a last resort. If Google are that stringent about caching, I'd rather develop a workflow that allows for easy renaming of files.

I don't know your workflow, but maybe you can work with versioned directories? Like so:

www.example.com/50/resources/resource.js
www.example.com/51/resources/resource.js

that would keep whatever caching the client employs intact, but whenever there's a change from your end, the browser would reload the content.

Pekka
+1 I think thats the issue.
S.Mark
That's probably the cause, in most browsers you can force a full refresh by pressing ctrl-f5
Thomas
A: 

I think Its just a cache on the browsers, So when you request file from ajax, just add random parameters or version number.

For example, Stackoverflow add version parameter to static contents like

http://sstatic.net/so/all.css?v=6638

S.Mark
Thanks. I'll try that!
Frexuz
A: 

Are you talking about uploading files to the "Downloads" area? Those should have distinct filenames, for example they should be versioned. If you're uploading the script code, that should be submitted by the version control system you're using, and should most definitely keep the same name across revisions.

Edit: your code snippet didn't show up on my page, misunderstood what you're trying. Don't imagine Google would be happy with you referencing the SVN repository every time some client page is loaded :)

Joe Kearney
Yes. It's the download section. That's maybe what's wrong in the first place?
Frexuz
That download section is for other developers to download a copy for them selves to use on there own sites, not for you bum hosting. Hot linking and using other peoples bandwidth, as epic as it may be, is real internet/webdev faux pas
thecoshman