How to clear cookies in IE7 on quit?

3

0

How do I make the Internet Explorer 7 delete all private data on quit? I've found the option to clear the cache, but that does not clear cookies and the history.

Jost

Posted 2013-01-07T21:00:38.087

Reputation: 135

Are you sure there's no in-built option? (Been a long time since I used IE7!) This KB article seems to indicate a Delete browsing history on exit option (1, 2) that can clear cookies etc. If that doesn't help, guess you can try launching the browser from a batch file that then calls CCleaner.

– Karan – 2013-01-08T00:31:40.927

Hi Karan! The Delete browsing history on exit option is only available in IE8 and above. It is the option I'm actually using to get things done in these newer IEs. Also, it is possible to clear cookies/cache/history/... from the command line (1). The problem with that approach is that my IE instance is launched by selenium webdriver, and not from a shell.

– Jost – 2013-01-08T01:03:07.023

"The Delete browsing history on exit option is only available in IE8 and above." - Weird. I took the screenshots from the KB article, and according to Microsoft IE7 has that option (see the How to delete cookie files in Internet Explorer 7 section). IE6 lacks it, and you can clearly see the difference between IE7 and IE8's Delete browsing history dialog options (IE8 has more). – Karan – 2013-01-08T16:15:59.780

The screenshots seem to be taken in Windows Vista - I'm using Windows XP. Maybe there is a difference between those systems? – Jost – 2013-01-08T16:21:25.363

I don't think the same version of IE would offer different options based on the OS, but I'm not sure... – Karan – 2013-01-08T16:29:34.487

Answers

4

The best you can do in IE7 is to go into Tools / Internet Options / Advanced Tab, scroll down and check the box "Empty Temporary Internet Files folder when browser is closed". However, there are reports that this doesn't work for cookies.

Therefore here is another solution that clears cookies every time that you logoff Windows.

First, prepare a batch file (.bat) that contains one or more of the following commands:

Clear Cookies
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2

Temporary Internet Files
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8

History
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1

Form Data
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16

Passwords
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32

Delete All
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255

Delete All including files and settings stored by add-ons
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351

Then run the Group Policy Editor (gpedit.msc) and go to User Configuration / Windows Setting / Scripts (Logon/Logoff).

Right-click on Logoff and select Properties, click on Add, then on Browse, navigate-to and select the .bat file, click Open, OK, Apply, then OK.

Now when you logoff Windows the batch file will run and clean out your data.

harrymc

Posted 2013-01-07T21:00:38.087

Reputation: 306 093

Hi harry, I don't want to logoff and login again in into windows for each test run (Selenium). Even if it is possible to do that automatically, I'd probably need to run a command in the shell to do it. And if I do that, I could directly run one the above commands. So this does not help me, sorry. The list of commands is nice, though. – Jost – 2013-01-11T23:16:26.710

If you are really sure that nothing more is possible in with IE7, I'll accept your answer. – Jost – 2013-01-11T23:19:16.713

I don't know of and have not been able to find anything else, but this doesn't mean that it doesn't exist. I suggest waiting until the end of the bounty period in case somebody comes up with another answer. – harrymc – 2013-01-12T08:53:17.083

Because this is the best answer and noone seems to disagree with it, I accept it and award the bounty. – Jost – 2013-01-16T21:48:58.093

0

As far as I know, that happens when you use InPrivate Browsing.  Open a new tab and click on “Open an InPrivate Browsing window”, or select “InPrivate Browsing” from the “Tools” menu.  That seems to put you into a semi-sandbox that does not save things like cookies and history.  Of course you can download files and Add to Favorites.

Scott

Posted 2013-01-07T21:00:38.087

Reputation: 17 653

Hi Scott! Good idea. The problem is: IE7 does not have InPrivate Browsing. That was introduced in IE8. I can't switch to IE8, because the I'm doing cross-browser testing and need to test the application in IE7. It would actually solve a lot of problems if InPrivate was available in IE6+. – Jost – 2013-01-07T22:40:08.573

D’oh!  Also oops. – Scott – 2013-01-07T22:56:04.507