Technical Q&A QA1736

How do I prevent my WebKit-enabled application from writing to the shared icon database?

Q:  How do I prevent my WebKit-enabled application from writing to the shared icon database?

A: There are two ways you can prevent your application from writing to the shared icon database:

No Code Method

- Add the WebIconDatabaseEnabled key to your defaults.plist file, and set the value to NO.

In-Code Method

- Add the code from Listing 1 to your application's main() routine. You must add this code *before* calling NSApplicationMain(), or it will not work.

Listing 1  

[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebIconDatabaseEnabled"];

The solution is to turn off the use of that database by your application. Setting WebIconDatabaseEnabled to NO does this. This key is not currently documented, but is safe to use.

Please refer to rdar://problem/9065438, where WebKit currently defaults to YES.



Document Revision History


DateNotes
2011-03-23

New document that shows how you can prevent your application from writing to the shared icon database.