Re: Creating WebView in code
Re: Creating WebView in code
- Subject: Re: Creating WebView in code
- From: Jenny M <email@hidden>
- Date: Fri, 2 Apr 2010 13:19:15 -0700
On Fri, Apr 2, 2010 at 9:40 AM, Nick Zitzmann <email@hidden> wrote:
> That's most likely Flash Player at work, since it's been known to do this. To work around it, install a dummy SIGINT handler function that does nothing. See the signal man page for details.
>
Yup, you're right. That was just something I saw in an example; I
changed it to load a plain test html file, and that seems to work fine
(aka it doesn't crash).
> You must place the WebView in a window or else it won't render. It's a dumb but necessary requirement. So you'll need to also create an NSWindow and add the WebView as a subview of its content view, and that ought to work.
>
D'oh, you told me that before and I completely forgot. So I tried
that, but the page still appears blank. I don't want the page to be
visible so I didn't set makeKeyOrderFront.
--------------------
NSRect frame = NSMakeRect(0.0, 0.0, pageSize.width, pageSize.height);
NSWindow *window = [[NSWindow alloc] initWithContentRect:frame
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered
defer:NO];
WebView *myWebView = [[WebView alloc] initWithFrame:frame
frameName:@"Test Frame" groupName:nil];
[[myWebView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL
URLWithString:@"http://www.jenstechs.net/test/testpage.html"]]];
[window setContentView:myWebView];
--------------------
I also tried setting the content view before loading the request, but
both still result in blank pages....
Sorry for not quite getting this yet, but I do hope this discussion is
useful for someone besides myself!
Thanks,
Jenny
_______________________________________________
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