On 01/17/2013 10:54 AM, Dietrich Streifert wrote: > Hi Alexander! > > Thank you for your answer. > > I'm running on apache so this may be a part of the solutions I'm > searching for. > > I WANT the app.js to be cached UNTIL the file version changes.
A canoncial solution would be to do as Alexander suggested and have the *app.js* as no-cache so any potential change to this file is picked up immediately. This should be a small overhead if you use the Generator features so that app.js only contains the loader logic. All application class code is then in subsequent .js files. These files are build-dependent, which is reflected by a hash in their names, and can be cached indefinitely (or for a very long time). If their contents changes their name will change, which is then reflected in the loader (which contains a list of their names), and the loader in turn will request the new files with new names (which have never been cached before). So automatically only changed application code will be requested. This approach would give you maximum immediacy of new code, with minimal download overhead. The HTML page can also be cached indefinitely as its contents never changes. If you feel that reloading the loader every time is still to much network footprint, and want to stick with an HTML-based solution, you'd need to add a custom job to the Generator's "build" job that essentially renames the generated loader and inserts the new name into the HTML page (a couple of lines of code if you do it in Perl or Python). There is currently no HTML templating support in the Generator. T. > > The html file (index.html) which loads app.js already has in <head>: > > <meta http-equiv="Expires" content="0"> > <meta http-equiv="cache-control" content="no-cache"> > <meta http-equiv="Pragma" content="no-cache"> > > which is I think equivalent to using mod_headers with: Header set Pragma > "no-cache" and should therefore never get cached by the browser (or am I > wrong here?). > > So opening index.html should reliably indicate to the browser if the url > of the script tag changed which should cause an uncached load. > > > > Am 17.01.2013 10:40, schrieb Alexander Voronin: >> There is another solution. Depending on yours HTTP server you may send >> header "Cache-Control: no-cache" using special settings. >> For apache you may use this directives in .htaccess file: >> >> <filesMatch ".(js|css)$"> >> FileETag None >> <ifModule mod_headers.c> >> Header set Pragma "no-cache" >> </ifModule> >> </filesMatch> >> >> If you'r using IIS create Web.config with following settings >> in system.webServer section: >> >> <httpProtocol> >> <customHeaders> >> <add name="Cache-Control" value="no-cache" /> >> </customHeaders> >> </httpProtocol> >> > > ------------------------------------------------------------------------------ > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft > MVPs and experts. ON SALE this month only -- learn more at: > http://p.sf.net/sfu/learnmore_122712 > _______________________________________________ > qooxdoo-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > > ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnmore_122712 _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
