Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WebPreferences* prefs = [webView preferences];
- [prefs _setLocalStorageDatabasePath:@"~/Library/Application Support/MyApp"];
- [prefs setLocalStorageEnabled:YES];
- WebPreferences* prefs = [webView preferences];
- [prefs _setLocalStorageDatabasePath:@"~/Library/Application Support/MyApp"];
- [prefs setLocalStorageEnabled:YES];
- static NSString* _storageDirectoryPath();
- + (NSString *)_storageDirectoryPath;
- #include "WebStorageManagerPrivate.h"
- #include "WebPreferencesPrivate.h"
- NSString* dbPath = [WebStorageManager _storageDirectoryPath];
- WebPreferences* prefs = [self.webView preferences];
- NSString* localDBPath = [prefs _localStorageDatabasePath];
- // PATHS MUST MATCH!!!! otherwise localstorage file is erased when starting program
- if( [localDBPath isEqualToString:dbPath] == NO) {
- [prefs setAutosaves:YES]; //SET PREFS AUTOSAVE FIRST otherwise settings aren't saved.
- // Define application cache quota
- static const unsigned long long defaultTotalQuota = 10 * 1024 * 1024; // 10MB
- static const unsigned long long defaultOriginQuota = 5 * 1024 * 1024; // 5MB
- [prefs setApplicationCacheTotalQuota:defaultTotalQuota];
- [prefs setApplicationCacheDefaultOriginQuota:defaultOriginQuota];
- [prefs setWebGLEnabled:YES];
- [prefs setOfflineWebApplicationCacheEnabled:YES];
- [prefs setDatabasesEnabled:YES];
- [prefs setDeveloperExtrasEnabled:[[NSUserDefaults standardUserDefaults] boolForKey: @"developer"]];
- #ifdef DEBUG
- [prefs setDeveloperExtrasEnabled:YES];
- #endif
- [prefs _setLocalStorageDatabasePath:dbPath];
- [prefs setLocalStorageEnabled:YES];
- [self.webView setPreferences:prefs];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement