在 OS X 10.10.1 (Yosemite) 上的 Safari 8.0 (10600.1.25.1) 中,我访问了一些网站,如 google.com、apple.com、facebook.com,然后当我单击“Safari”->“首选项”时可以看到 cookie ...”->“隐私”->“详细信息...”
然后我完全退出了Safari(实际上是退出,不仅仅是关闭窗口),并使用以下内容删除以下内容。
rm -r ~/Library/Caches/com.apple.Safari/
rm -r ~/Library/Cookies
rm -r ~/Library/Safari
当我重新启动 Safari 时,cookies 仍然存在并且我仍然登录到一个在登录后存储 cookie 的网站。
我需要删除哪些文件,或者我必须做什么才能让 Safari 真正删除 cookie?
我需要能够移动/重命名文件/目录,然后再将它们移回。 Cocoa Cookies 可以删除 cookie ( http://ditchnet.org/cocoacookies/ ) 和当我使用时 fswatch没有有趣的文件发生变化。
最佳答案
我认为 Apple Script 是这里要走的路,看看 the linked blog entry here .下面我复制了谷歌脚本示例。
1 set deCookie to {"nytimes.com", "go.com", "cnn.com"}
2
3 tell application "System Events"
4 tell process "Safari"
5 keystroke "," using command down
6 delay 1
7 tell window 1
8 click button "Privacy" of tool bar 1
9 delay 3
10 repeat with d in deCookie
11 click button "Details…" of group 1 of group 1
12 try
13 keystroke d
14 delay 1
15 select row 1 of table 1 of scroll area 1 of sheet 1
16 click button "Remove" of sheet 1
17 end try
18 click button "Done" of sheet 1
19 end repeat
20 end tell
21 keystroke "w" using command down
22 end tell
23 end tell
关于macos - 如何在 OS X 10.10 (Yosemite) 上的 Safari 8.0 中以编程方式删除 cookie,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27254828/