Search code examples
internet-explorercookiescom

Programmatically clear IE history, cookies, cache while IE is open


If I have an instance of IE open, with access to the underlying COM objects (IWebBrowser2 etc...) can I programmatically clear out all of the history, cookies and cached data?

Is there a way to do it in both private mode and non private mode without closing the browser and reopening it?

I have tried spawning rundll32.exe inetcpl.cpl,ClearMyTracksByProcess 1023 with various combinations of the bit flags passed as arguments, but it only seems to work when the browser is closed, and I need a solution that allows the browser to stay open.


Solution

  • Caching is done by wininet, not mshtml.

    There are good samples of this at: https://msdn.microsoft.com/en-us/library/aa383928(VS.85).aspx