How to clear the cache of a WebBrowser Widget

Is it possible to clear the cache of a WebBrowser? If so: How?

Thanks in advance!

I want to know this too!

Me tooā€¦very frustrating for checking changes made to a web page to see if it looks ok !!!

Really hope someone answers this!

close unreal, go into the project folder projectname\saved\webcache, and delete everything in there.

Thanks you so much!

Throwing a few ideas, this could be automated using C++, and support for a ā€œno-cacheā€ mode that does this could be made1

Do it yourself. Not that Hard. A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums

Although I think deleting the directory programmatically is a good idea. I have found that calling either IPlatformFile::DeleteDirectory or IPlatformFile::DeleteDirectoryRecursively fails on the webcache folder because the game/application uses files in the directory while itā€™s running.

Hiļ¼ŒHow to run in no-cache modeļ¼Ÿthanks.

Hi,
After a lot of struggle, I was successfully able to clear the browser cookies from the game. A little bit of c++ coding will be needed in this case.

Add WebBrowser module in your build.cs file
Create a c++ class blueprint library
import the following classes

#include "IWebBrowserCookieManager.h"
#include "IWebBrowserSingleton.h"
#include "WebBrowserModule.h"

Make a blueprint callable function and paste the following code:

IWebBrowserSingleton* WebBrowserSingleton = IWebBrowserModule::Get().GetSingleton();
    if (WebBrowserSingleton)
    {
        TSharedPtr<IWebBrowserCookieManager> CookieManager = WebBrowserSingleton->GetCookieManager();
        if (CookieManager.IsValid())
        {
            CookieManager->DeleteCookies();
        }
    }

Call this function from your blueprint anywhere.

3 Likes