Hi folks
I thought this "fix" might be of use for some people.
We had some issues on keytone.com with members customising their styles, and therefore their profile CSS file, but the CSS file was being cached by the browser.
A good way to fix this in a regular web page is to check the last-modified time of the file, and append a timestamp to the URL when requesting.
e.g.
$cssPath = ... // path to CSS file
$cssUrl = $cssUrl.'?'.filectime($cssPath);
This makes the URL look something like "editor.css?2342342"
However, if you set EditorAreaCSS to this value, it won't work. The reason is because of the regular expression in FCKTools.GetStyleHtml(), which checks to see if the string passed to it looks like a URL. With the timestamp appended, it doesn't, according to the reg exp.
You can find this function in a readable format in internals/fcktools, but this is not the actual code that gets used. The code that gets used is in fckeditorcode_gecko.js and fckeditorcode_ie.js.
To make the fix, change this pattern:
/[\\\/\.]\w*$/
to
/[\\\/\.]\w*(\?\d+)?$/
in each of those two files. There are two occurences of the pattern in each file (don't ask me why).
HTH!
Shaun
I thought this "fix" might be of use for some people.
We had some issues on keytone.com with members customising their styles, and therefore their profile CSS file, but the CSS file was being cached by the browser.
A good way to fix this in a regular web page is to check the last-modified time of the file, and append a timestamp to the URL when requesting.
e.g.
$cssPath = ... // path to CSS file
$cssUrl = $cssUrl.'?'.filectime($cssPath);
This makes the URL look something like "editor.css?2342342"
However, if you set EditorAreaCSS to this value, it won't work. The reason is because of the regular expression in FCKTools.GetStyleHtml(), which checks to see if the string passed to it looks like a URL. With the timestamp appended, it doesn't, according to the reg exp.
You can find this function in a readable format in internals/fcktools, but this is not the actual code that gets used. The code that gets used is in fckeditorcode_gecko.js and fckeditorcode_ie.js.
To make the fix, change this pattern:
/[\\\/\.]\w*$/
to
/[\\\/\.]\w*(\?\d+)?$/
in each of those two files. There are two occurences of the pattern in each file (don't ask me why).
HTH!
Shaun
Re: Caching of CSS files
I've just added your solution to the relative ticket at our dev site.
Thanks for your findings.
Frederico Knabben
CKEditor Project Lead and CKSource Owner
--
Follow us on: Twitter | Facebook | Google+ | LinkedIn