[TxMt] HTML output cache question

Hans-Joerg Bibiko bibiko at eva.mpg.de
Thu Mar 6 07:56:42 UTC 2008


On 6 Mar 2008, at 00:17, Thomas Aylott - subtleGradient wrote:
> On Mar 4, 2008, at 3:32 PM, Hans-Jörg Bibiko wrote:
>> I have a tmcommand which generates HTML code on basis on a shell  
>> script. Fine, after invoking it I see my result.
>> In addition I added a button called 'Refresh' to that HTML page. I  
>> want to use it to start that shell script again (which writes the  
>> HTML code to a file) using TextMate.system and then via JavaScript  
>> 'location.href' or 'location.replace()' to refresh the HTML output  
>> window.
>>
>> Well, this only works if I press the button at least twice or  
>> three times(?).
>> After pressing the refresh button I had a look at the new  
>> generated html file and the content is correct, but TM'S HTML  
>> output window displays still the 'old' version.
>> I tried the meta tags no-cache and expire with '0'. No success. I  
>> also changed the actual html code a bit to be sure that TM  
>> recognizes it's a new document.
>>
>> Is there a built-in cache for the HTML ouptut? Or can someone  
>> advice me? How can force TM to refresh the HTML output?
>>
> I'd suggest replacing the html of the current window instead of  
> changing the url.
> But if you're dead set on just changing the url, add a unique get  
> string to the end EG: myfile.html?342739847923 to force the caching  
> system to assume it's a different file.
>
> Replacing the html with innerHTML or something would be a lot  
> faster and bugfree.
>

Thanks. Finally I went that way using innerHTML. The idea using  
myfile.html?342739847923 also works but unfortunately I also have to  
deal with images which have the same URL but I change the content of  
these images with a script.

There is also an other issue. If I press a button within an HTML  
output window very slowly - meaning press the button down, wait a  
second, and release it - works sometimes better than a 'fast' click.  
I don't know whether this is an issue of TM's internal event loop in  
conjunction with TextMate.system().

But anyway, it would be nice to have an option to force the HTML  
window to avoid caching the content.

--Hans


More information about the textmate mailing list