I\'d like to append a random string to an element\'s attribute, using either jQuery or javascript.
I need to reference a CSS f
You can get just part of the date, for example:
var d = new Date;
// this string will change once a day for the same user
var rnd_str_day = d.getFullYear() + '_' + d.getMonth() + '_' + d.getDay();
href= 'http://example.com/style.css?' + rnd_str_day;
// this string will change once an hour
var rnd_str_hour = d.getFullYear() + '_' + d.getMonth() + '_' + d.getDay() + '_' + d.getHours();
href= 'http://example.com/style.css?' + rnd_str_hour;
And so the css will be uncached once a day or an hour, depending on your requeriments.