-
Notifications
You must be signed in to change notification settings - Fork 187
Description
Describe the bug
There seems to be no way to clear the internal cache of the browser used in Eclipse (new Browser(..)). In Windows (7-10), when MSIE11 is used, the best way to clear the cache is to execute the process:
Process p=Runtime.getRuntime().exec(new String [] {
"RunDll32.exe",
"InetCpl.cpl",
"ClearMyTracksByProcess",
"8"
});
p.waitFor();but when MSEdge is used in some mode in Windows 11 (I don't know if it's MSIE11 compatible mode or just normal Edge mode), then there is NO way to actually clear the cache.
For all these operations, you must refresh the SWT Browser instance with a reload once the cache has been cleared (of course), or do this prior to creating the Browser instance.
From the browser component, you can e.g. press F12 to open the DevTools and from there clear the cache. But for some reason, that is not the cache being used. Even if clearing the cache in a stand-alone instance of MS Edge and clearing the cache (Shift+Ctrl+Del > Clear now and also [Clear browsing data for Internet Explorer mode](edge://settings/clearBrowserData#)) does not help. Trying other methods to locate directory such as %LOCALAPPDATA%\Microsoft\Edge\User Data\Default\Cache\Cache_Data and deleting all files does not work either (the directory can be queried using e.g. the command reg query HKEY_CURRENT_USER\Software\Microsoft\Edge\Profiles /s /f Path, replying e.g. Path REG_SZ
C:\Users\USERNAME\AppData\Local\Microsoft\Edge\User Data\Default).
Other locations such as %LOCALAPPDATA%\Microsoft\Packages\Microsoft.MicrosoftEdge.Stable_8wekyb3d8bbwe where 8wekyb3d8bbwe could be different for every machine and Windows update, e.g. in my case
Microsoft.MicrosoftEdge.Stable_8wekyb3d8bbwe
Microsoft.MicrosoftEdgeDevToolsClient_8wekyb3d8bbwe
Microsoft.MicrosoftEdge_8wekyb3d8bbwe
under wich directory the subdirectory AC\Temp could be found and certain posts on the internet suggests to delete files or directories beginning with #! or something like it (this could be related to older versions os MS Edge).
The problem is that we have an embedded Jetty instance running on localhost serving a port with HTTP. Changing files on for the webserver, e.g. JavaScript files are never reflected in the internal Eclipse Browser component when created using new Browser(parent...). Jetty is configured to use Etag (weak ETags) and we even add Last-Modified timestamp, but nothing helps. We use the SWT Browser component to load content from http://localhost:port/....
If MSEdge (or any other browser - without clearing the cache) is used to load the SAME modified file (e.g. JavaScript), then it shows the correct content. BUT NOT the internal SWT Browser component! So one really starts to wonder what goes on under the hood (the Eclipse File System? We also try to refresh that one in the Workspace)...
It is imperative to clear this cache, whether done using an API or that we do it programmatically in order for our code to work.
Please advise best way to do so. I can't find any documentation that actually works to clear the MSEdge cache used for Eclipse new Browser(..) instances.
Environment:
- Select the platform(s) on which the behavior is seen:
-
- All OS
-
- Windows
-
- Linux
-
- macOS
-
Additional OS info (e.g. OS version, Linux Desktop, etc)
Windows 11. We do use Eclipse with "Wild Web Developer" if this would perhaps interfere? -
JRE/JDK version
Java 17 or 18, any flavor (Temurin, etc).
Version since
Eclipse 4.24, currently on 4.25 M1.
Workaround (or) Additional context
If anybody knows how to do this, please comment! Thank you very much.