Web View Quandry - Prefer "Live" version over "Cached" version

Hi,

I am updating an AppleScript Studio (probably for the last time) and would like to include a web view, or webview.

So I added the following code:

on urlGet()
	set theURL to "http://accounts.myserver.com/~" & myid & "/Updates/myimage.jpg" as text
		
		try
			set newString to (call method "stringByAddingPercentEscapesUsingEncoding:" of theURL with parameter 30)
			set URLWithString to call method "URLWithString:" of class "NSURL" with parameter newString
			set requestWithURL to call method "requestWithURL:" of class "NSURLRequest" with parameter URLWithString
			set mainFrame to call method "mainFrame" of webView
			call method "loadRequest:" of mainFrame with parameter requestWithURL
	on error theError
	end try
end urlGet

This works very well, except that if the image is changed on the server, the web view will always display the cached copy located in ~/Library/Caches/com.mycompany.myapp/Cache.db

If I manually clear the cache, the image updates properly

How do I change my code so that it prefers the “live” copy to the cached copy, unless, of course, the server is unreachable?

I can’t help with your ASStudio code, but you’re calling +requestWithURL:, and you need to call +requestWithURL:cachePolicy:timeoutInterval:. The cachePolicy parameter is the key for what you want.