Is there a way to clear cache of webview?

I have a script that gets a link from a site that is updated weekly, but it usually gets the cached version that is usually outdated by a week.

Is there a way to clear the cache or force it to load it fresh?

Here it is.

// Fetches page and returns querySelector results

let urlDefault = "";
let url = args.urls[0] || urlDefault

let wv = new WebView();

await wv.loadURL(url);
let html = await wv.getHTML()
// let html2 = await wv.waitForLoad() 
// let html2 = await wv.loadHTML() 

let selectorScript = "document.querySelector(`a[href*='.pdf'`).getAttribute('href')"
let js = args.plainTexts[0] || selectorScript

let runjs = await wv.evaluateJavaScript(js);


// return runjs
// await wv.present();
// Script.complete();

You could apply a cache busting approach and add a random query string to the page URL to force a load from outside of cache.

1 Like

Thanks I thought I had tried that, but I set it up again and we will see how that works.