2 Replies Latest reply on May 8, 2008 1:39 PM by Schdeffan

    HTML control, reloading CSS


      I'm developing an application that displays generated HTML-code in an HTML control. The HTML-code also has a link-tag pointing to a .css file on the filesystem. The HTML is rendered fine using the .css.

      But when I change the .css file in the filesystem, I cannot see the changes in my application. Reloading (I set the htmlText property) does not work, neither does deleting the HTML control and creating a new one. I have to restart the application for the changes in the .css file to take effect.

      Does someone know, what I need to do to reload CSS for a webpage displayed in an HTML-control?

      To avoid confusion: This is not about the stylesheet for themeing the application.

      Any help very much appreciated.

        • 1. Re: HTML control, reloading CSS
          Joe ... Ward Level 4
          If the css file is in the application directory, then I believe it is loaded into memory only once.

          To get around this you could:
          A. Copy the css file to the application storage directory (you would still have to reload the page to show changes)
          B. Make the changes in memory by manipulating the style sheet properties of the page directly -- the changes will appear immediately
          • 2. Re: HTML control, reloading CSS
            Schdeffan Level 1
            Hello Joe,

            thanks alot for your answer.

            I tried option a, unfortunately to no avail. The css file normally lies somewhere on the filesystem not in the app-dir. I copied it to the applicatoinstorage directory on runtime, work on that copy and use that copy in the HTML view. But I still can't see changes.

            I can't use option b. I'm writing an application where the user should be able to edit the css file. That can be quite complex. I'm not sure how I should set these complex styles using the DOM API.

            But your post pointed me to something that should've been more obvious:
            When the user changes something, I can save the css to a new file and then use that one in the HTML. Then I see changes. But I'm not quite happy with that solution. I'd prefer to only change the original file instead of copying files around and creating new ones. Is there no way to invalidate the cache that's used?

            Btw: I'm using Flex/AS3