0

I have a tomcat web app that I am developing that makes heavy use of javascript/jquery. There are times when the admin user of the application (we have users integrated with LDAP) would like to adjust some of the common display settings. For example, today he came to me and asked if I could reduce the font size of one of the heading's. This required me to modify the css for that heading class.

My question is, would there be a way to integrate a "Settings" page to my webapp, where the admin can modify things like font styles, sizes, and faces and have it update the CSS on the server? Something tells me that is a big security no-no, but I figured I would ask as I couldn't find anything from a web search.

  • The one thing comes to mind is that your web app could read something set by Tomcat (which you'd need a custom web page for), and have to inject that into your CSS/HTML – Ian Jul 10 '14 at 19:51
  • I was thinking the same, but I figured that it would cause a few issues: 1. It doesn't account for caching, so even after setting the new font, users may still see the original; 2. Risk in injecting to a file on the server. – paimon.soror Jul 10 '14 at 19:56
  • 1
    @paimon.soror the caching issue can be resolved by keeping track of the last time the settings were modified and including this time on the query string of the css. For example, if you were using jsp, `` [See this post](http://stackoverflow.com/questions/17479748/refresh-image-in-jsp-avoiding-cache) – abl Jul 10 '14 at 20:33
  • @abl Technically, that causes the file to never be cached (or at least shouldn't). Any resource with a querystring shouldn't be cached. But still, adding the querystring with the `lastUpdated` changing should definitely fix whatever caching problem – Ian Jul 11 '14 at 00:40
  • @Ian I wasn't aware of this. There's a good discussion [here](http://stackoverflow.com/questions/118884/what-is-an-elegant-way-to-force-browsers-to-reload-cached-css-js-files). It seems that you are right; that is, the HTTP spec says a file should never be cached in this case. However, some popular browsers are ignoring this rule. – abl Jul 11 '14 at 13:11

0 Answers0