Clear Webview cache?

I can't seem to login to ChatGPT anymore. Is there any way I can clear the WebView cache that I'm using on my Floating Menu?

so far it was only possible by right clicking the webview and using the inspect menu.
However with v4.183 I have added a "Clear Webview Caches" right-click menu item. (Currently building & uploading)

I think this issue happened to me once when OpenAI broke their webworker process - the new clear webview caches will also reload the webworkers.

1 Like

Thanks! Ok, so the cache clearing process didn't work for me and I guess I'll wait for ChatGPT to fix itself.

weird, it seems to work fine here. Can you log in in Safari?

Yes, works just as usual. I will send you the logs today.

Here's the log. ChatGPT now basically loops through the Cloudflare check infinitely.

I see this error line in logs:

1691230476.357020|ASL|res (null), Error Domain=WKErrorDomain Code=4 "A JavaScript exception occurred" UserInfo={WKJavaScriptE
xceptionLineNumber=1, WKJavaScriptExceptionMessage=SyntaxError: Unexpected token ';'. Expected ')' to end a compound expressi
on., WKJavaScriptExceptionColumnNumber=0, WKJavaScriptExceptionSourceURL=https://chat.openai.com/, NSLocalizedDescription=A J
avaScript exception occurred}|

I had some custom javascript that'd autofocus the text field on ChatGPT right on load. I removed it, cleared the cache and restarted BetterTouchTool but I still get the same error.

bug in the openai code, maybe it is still cached for some reason :-/
I'll check if I need to clean some other caches in addition to the ones that are currently being cleaned

Wow, seems like my webview user-agent setting was creating a problem here.

I am using this one so Bing Chat works:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36 Edg/111.0.100.0

After I removed it I could successfully login and now ChatGPT works. Bing Chat now won't run (because it needs "Edge"), obviously.

I guess it'd be great to set separate user-agent strings on "Load New Html..." action running.

I just tried with the latest Edge string and ChatGPT still doesn't work.

https://www.whatismybrowser.com/guides/the-latest-user-agent/edge

Now I tried using the default Chrome one (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.100.0) and it still doesn't work. It works with Bing. It indeed seems like a ChatGPT-specific issue. No matter what user-agent you pass to it, it doesn't work.

So I just got to look at your debug data.

I think the problem was two parts:
1.) OpenAI is doing bot checks, and the broken focus javascript you inserted, caused that to fail. If you want to keep that script, only use this:
document.querySelector('textarea').focus();
any other characters are not needed and will break it.
2.) OpenAI checks whether the User Agent you tell it, actually fits the browser you are using. As BTT is based on Safari's rendering engine, you need to use the Safari user agent for this.

In 4.184 I have added the possibility to set the user agent in the "Load New Html..." action

Two more tips about your webview setup:
1.) I would recommend to keep it active in background:

2.) To save some memory, make it only visible on hover:

3.) If possible change the menu positioning on screen. Currently you are positioning it based on the built in screen's top right corner and the menu's left edge. Then you move it slightly to the left. This works fine if you only have one display. The problem is this means it will be mostly visible on the screen right to the built in screen (if any) - and unfortunately macOS doesn't allow windows to span across displays by default. Instead I'd recommend to reduce the min width, so you can fit it completely on the screen where it will be shown later.
(I know this currently won't be able to produce the exact same visual effect because it will also round the right corners - I will soon provide an option to choose the corners that shall be rounded)

1 Like

Thanks so much for the tips, Andreas!

The possibility to set the user agent in the "Load New Html..." action in 4.184 solved my issue!

I'll try going over 3) soon.