Friday, September 6, 2013

Automatically Delete Local Shared Objects

Also called "flash cookies," Local Shared Objects" (LSO's) can be used by any web site to store information about your web browsing.  Web developers explain that this capability is used "to enhance your web-browsing experience," but skeptics (like me) know that it can also be used to track a user's browsing in detail and even to share that information with unsavory sites.  LSO's may or may not be cleared when you attempt to clear your browser's cookies.

LSO's may be important to some applications.  Games, for example, may save the current state of the game in LSO's, so that the game can be stopped and then resumed.  However, in my computer usage I do not know of any such beneficial application of LSO's and I prefer to delete them.

Third parties have created extensions for some of the browsers which will delete LSO's automatically.  However, this script will also do it, without installing an extension:

    TITLE "Delete Local Shared Objects"

:: Delete Local Shared Objects in a very heavy-handed way:

    SET SYSPATH="%APPDATA%\Macromedia\Flash Player\\support\flashplayer\sys"
    SET IE2LSO="%APPDATA%\Macromedia\Flash Player\#SharedObjects"
    SET GOOPATH="%LOCALAPPDATA%\Google\Chrome\User Data\Default\Pepper Data\Shockwave Flash\WritableRoot\\support\flashplayer\sys"
    SET GOOGLSO="%LOCALAPPDATA%\Google\Chrome\User Data\Default\Pepper Data\Shockwave Flash\WritableRoot\#SharedObjects"
:: Delete LSO's for IE and FireFox, preserving the flash settings:

    XCOPY /y /q /h /r %SYSPATH%\settings.sol %TEMP%\*
    RMDIR /s /q %SYSPATH%
    RMDIR /s /q %IE2LSO%
    XCOPY /y /q /h /r %TEMP%\settings.sol %SYSPATH%\*
    DEL /f /q %TEMP%\settings.sol

:: Delete LSO's for Chrome, nevermind the flash settings (use defaults):

    RMDIR /s /q %GOOPATH%
    RMDIR /s /q %GOOGLSO%

:: Optionally start one of the browsers.  Also possible to specify a "home" URL here:

    START "" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
::  START "" "C:\Program Files (x86)\Internet Explorer\iexplore.exe"
::  START "" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"


Put this code in a script file with a .CMD extension, e.g. DELETELSO.CMD.  Then create a shortcut to that script and set Properties/Shortcut/Run to Minimized.  Put the shortcut on your desktop, or Quick Launch bar, or wherever you want it.  Use it any time you want to clear the LSO's.  It can also be used to start the browser of your choice after it clears the LSO's, see the code.  That's how I use it.  If you have trouble copying the code from this screen, try this instead, making your screen wide.

Note:  This is a VERY HEAVY-HANDED way to approach the problem and could produce unanticipated and hard-to-diagnose results.  Please check for problems with your favorite web-based applications before you forget that you did this and start looking for problems in the wrong places.  This script comes with no warranty, and you can only sue me for the amount that you paid for it.

The above script has been tested and is in use on Vista and Windows 7.  It has not been tested on Windows 8, and it will not work without modification on Windows XP.

I've had this in place for several months now, using it to start Chrome any time I want a browser, and have not identified any problems in my use of the Chrome browser.

Comments, complaints?