Re: stripped down webview

2012-08-20 Thread Koen van der Drift
D'oh, I just discoverd that the website I'd like to display has a mobile version, which is already basic. I'll just display that instead in my webView. This only needs some minor tweaks to remove one or two divs, and saves me a lot of headaches. - Koen. On Sun, Aug 19, 2012 at 10:00 AM, Koen

Re: stripped down webview

2012-08-19 Thread Mike Abdullah
On 18 Aug 2012, at 22:48, Koen van der Drift koenvanderdr...@gmail.com wrote: Is there a similar way to inject an external javascript.js file into my webView? I think I can use that to strip out the divs I don't want to show. You could use the resource load delegate to substitute in a custom

Re: stripped down webview

2012-08-19 Thread Koen van der Drift
So for future reference, I figured out how to add my local javascript. This is what I do: - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame { if (frame == [sender mainFrame]) { NSError *error = nil; // get the DOMDocument

stripped down webview

2012-08-18 Thread Koen van der Drift
In my OS X app I show some webpages in a WebView, but I'd like to show them stripped down, remove clutter, e.g. as is done in Evernote and other apps. Any suggestions where to start? Maybe use a local css file? - Koen. ___ Cocoa-dev mailing list

Re: stripped down webview

2012-08-18 Thread Koen van der Drift
On Aug 18, 2012, at 7:24 AM, Koen van der Drift koenvanderdr...@gmail.com wrote: In my OS X app I show some webpages in a WebView, but I'd like to show them stripped down, remove clutter, e.g. as is done in Evernote and other apps. Any suggestions where to start? Maybe use a local css

Re: stripped down webview

2012-08-18 Thread Steve Christensen
How about asynchronously downloading the page HTML into a string, doing a text replace of the name of the CSS file to your local one, then passing the modified HTML to the web view? Sent from my iPhone On Aug 18, 2012, at 6:52 AM, Koen van der Drift koenvanderdr...@gmail.com wrote: On Aug

Re: stripped down webview

2012-08-18 Thread Jens Alfke
On Aug 18, 2012, at 8:26 AM, Steve Christensen puns...@mac.com wrote: How about asynchronously downloading the page HTML into a string, doing a text replace of the name of the CSS file to your local one, then passing the modified HTML to the web view? Doesn't work if there are style rules

Re: stripped down webview

2012-08-18 Thread Kyle Sluder
On Aug 18, 2012, at 4:24 AM, Koen van der Drift koenvanderdr...@gmail.com wrote: In my OS X app I show some webpages in a WebView, but I'd like to show them stripped down, remove clutter, e.g. as is done in Evernote and other apps. Any suggestions where to start? Maybe use a local css

Re: stripped down webview

2012-08-18 Thread Koen van der Drift
On Aug 18, 2012, at 1:40 PM, Kyle Sluder k...@ksluder.com wrote: This is a good start. I believe user stylesheet is the term of art for a local override stylesheet. From a quick Google, the relevant APIs are on the WebPreferences class: -setUserStyleSheetEnabled: and

Re: stripped down webview

2012-08-18 Thread Matt Patenaude
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]

Re: stripped down webview

2012-08-18 Thread Koen van der Drift
On Aug 18, 2012, at 2:46 PM, Matt Patenaude m...@mattpatenaude.com 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

Re: stripped down webview

2012-08-18 Thread Matt Patenaude
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 koenvanderdr...@gmail.com wrote: On Aug 18, 2012, at 2:46 PM, Matt Patenaude m...@mattpatenaude.com wrote: User stylesheets should work just fine,

Re: stripped down webview

2012-08-18 Thread Koen van der Drift
On Aug 18, 2012, at 3:26 PM, Matt Patenaude m...@mattpatenaude.com wrote: Ah! Your problem is URLWithString:. You want fileURLWithPath:. :) Well spotted, thanks! - Koen. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post

Re: stripped down webview

2012-08-18 Thread Koen van der Drift
Is there a similar way to inject an external javascript.js file into my webView? I think I can use that to strip out the divs I don't want to show. On Aug 18, 2012, at 3:32 PM, Koen van der Drift koenvanderdr...@gmail.com wrote: On Aug 18, 2012, at 3:26 PM, Matt Patenaude

Re: stripped down webview

2012-08-18 Thread Evadne Wu
You can use the DOM: dynamically create a Script tag then allow it to load more stuff by abusing -stringByEvaluatingJavaScriptFromString: . On Aug 18, 2012, at 2:51 PM, Koen van der Drift koenvanderdr...@gmail.com wrote: Is there a similar way to inject an external javascript.js file into my

Re: stripped down webview

2012-08-18 Thread Jens Alfke
On Aug 18, 2012, at 11:29 AM, Koen van der Drift koenvanderdr...@gmail.com wrote: This is a good start. I believe user stylesheet is the term of art for a local override stylesheet. From a quick Google, the relevant APIs are on the WebPreferences class: -setUserStyleSheetEnabled: and