Re: stripped down webview
Re: stripped down webview
- Subject: Re: stripped down webview
- From: Matt Patenaude <email@hidden>
- Date: Sat, 18 Aug 2012 12:26:26 -0700
Ah! Your problem is URLWithString:. You want fileURLWithPath:. :)
-Matt
Sent from my iPhone
On Aug 18, 2012, at 12:12 PM, Koen van der Drift <email@hidden> wrote:
>
> On Aug 18, 2012, at 2:46 PM, Matt Patenaude <email@hidden> wrote:
>
>> User stylesheets should work just fine, so you should try to figure out what's going wrong with that. Perhaps don't use standardPreferences; use [self.webView setPreferencesIdentifier:@"mySpecialPreferences"] to generate a new preferences object for your WebView, then [self.webView preferences] to get a preferences object to customize.
>
> Nope, still doen't work, the custom css is not used. Unless I did something wrong:
>
> [self.webView setPreferencesIdentifier: @"mySpecialPreferences"];
>
> WebPreferences *prefs = [self.webView preferences];
> [prefs setJavaScriptEnabled: YES];
> [prefs setCacheModel: WebCacheModelDocumentBrowser];
> [prefs setPlugInsEnabled: YES];
>
> NSString *path = [[NSBundle mainBundle] pathForResource: @"default" ofType: @"css"];
> NSURL *cssUrl = [NSURL URLWithString: path];
>
> [prefs setUserStyleSheetEnabled: YES];
> [prefs setUserStyleSheetLocation: cssUrl];
>
> [self.webView setPreferences: prefs];
>
>
>
>>
>> If that still doesn't work, why don't you just hide your WebView and show a spinner while it's loading, and then after it loads and you've injected your stylesheets, show it?
>
> The delay is a separate issue, but this works great to prevent it. Thanks!
>
> - Koen.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden