Re: NSAttributedString from html weirdness

Izidor Jerebic <[email protected]> Sat, 2 Oct 2010 10:19:32 +0200
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
This sounds like WebKit caching the css, and when reading html file, the cached css is applied. In your case, the easiest way to prevent caching is to append some random number to the css file name, so you create css file with unique name every time.

izidor


On 2.10.2010, at 2:11, Christiaan Hofman wrote:

> I'm getting a very weird problem when trying to create an NSAttributedString from a (temporary) html file with an external css file. Basically what happens is that the attributed string always keeps on using the same css file content, even if I change the css file completely. 
> 
> Here's a more detailed description of what I'm doing.
> 
> 1. create a temporary directory
> 2. write a (code generated) html file and css file used by that html file into this temp dir
> 3. create a new NSAttributedString from the html file URL
> 4. remove the temp dir
> 
> When I repeat the same procedure with /different/ css, then I get an attributed string that uses the style described with the /first/ css file (even though that file does not even exist anymore). This is very weird. However, changes in the html file are properly reflected in the NSAttributedString.
> 
> Can anyone make sense out of what is happening? It certainly makes absolutely no sense to me, but it's absolutely reproducible. Is this a (known) bug?
> 
> thanks,
> Christiaan
> 
> _______________________________________________
> MacOSX-dev mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/macosx-dev