I’m a big fan of the Cookie app for MacOS, which does an excellent job of scrubbing unwanted privacy-tracking cookies and other cruft from your web-browsing experience. But there’s one little problem: it can’t delete your history if you have iCloud bookmark sharing enabled, and Safari’s automatic “Remove history items” preference won’t do it either.
Meanwhile, the only Apple-supported method for clearing history nukes everything, including useful cookies like the ones that keep your bank from sending you text messages every time you try to login from a “new” browser.
The following AppleScript appears to be the only way to delete just your history from iCloud:
tell application "Safari"
activate
close windows
make new document
tell application "System Events"
tell process "safari"
keystroke "y" using command down
delay 1.0
keystroke "a" using command down
key code 51 # delete
end tell
end tell
end tell
After running it, you need to leave Safari open for a minute or two without using it, or else it will repopulate with the iCloud history from your iPhone or iPad (“ask me how I know”).
Seems this has the side-effect of causing Mobile Safari to freeze if it’s suspended on an iOS device, requiring you to force-quit it. At least, I’d never had Safari lock up on iOS so often. It’s almost like iCloud isn’t very good at this whole “sync” thing…
Bumped the delay to a full second. If you have a lot of history to nuke, it can take that long to load it all. The Mobile Safari freezes continue to be an issue after running this script, but it seems it will eventually recover on its own if you leave it running, and doing so will keep it from freezing again.
…until the next time you clean out your history, anyway. “Dear Apple, up your sync game”
Markdown formatting and simple HTML accepted.
Sometimes you have to double-click to enter text in the form (interaction between Isso and Bootstrap?). Tab is more reliable.