Forum Moderators: not2easy

Message Too Old, No Replies

reload css

         

sabongio

8:50 pm on Jul 15, 2005 (gmt 0)

10+ Year Member



hi all.

I'm having this prob with reloading css.

I have this page where a logged user can especify the colors of the page.

what I'd like to do is when the user hit the submit button change his css file put the values he chosed for the colores and display the pag with the changes. but the changes only appear when the user click in the refresh button(F5).

I've done some resears but no luck.

I'm using a external css file and php.

is it possible to do it?

thanks in advance.

Span

9:11 pm on Jul 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The advantage of external stylesheets is that it only has to load once and then it is in the cache of the browser... but in your case the file has to be served every time a page is requested.

If you are on Apache and you can use an .htaccess you could try:


ExpiresActive On
<FilesMatch "^style\.css$">
ExpiresDefault A0
Header unset Cache-Control:
Header append Cache-Control: "no-cache, must-revalidate"
</FilesMatch>

sabongio

9:16 pm on Jul 15, 2005 (gmt 0)

10+ Year Member



But do I need it to load the css every time?

Can I just for example reload it one time(for example in the page where the user chooses the colors) and then the reloaded css will be used by the others page from the cache?

Span

9:45 pm on Jul 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, the stylesheet only has to reload when a user makes a change. Since you are using PHP, it should be possible to detect the change and reload the page with the CSS. You would have to ask in the PHP forum...