BYOB: Build Your Own Browser, Part 2
Subject:   re:small correction
Date:   2005-03-08 17:14:35
From:   -JR-
Response to: re:small correction

I am having a problem with your tutorial here...(you should explain the second page a bit clearer) Heres my myDocument code, and i only assumed that all the code should go in there.. Would be nice with a reply, I am getting only three errors, but i cannot run the app; What is wrong and what more do you need to see? Thanx jR.

// MyDocument.m
// MMapp
// Created by JR on 09.03.05.
// Copyright __M & M__ 2005 . All rights reserved.
#import "MyDocument.h"
static NSString *defaultHP =@"file:///Users/jr/Desktop/flash/pageflip_v211.html";
@implementation MyDocument

- (id)init
self = [super init];
if (self) {

// Add your subclass-specific initialization here.
// If an error occurs here, send a [self release] message and return nil.

return self;

- (NSString *)windowNibName
// Override returning the nib file name of the document
// If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this method and override -makeWindowControllers instead.
return @"MyDocument";

- (void)windowControllerDidLoadNib:(NSWindowController *) aController
[super windowControllerDidLoadNib:aController];
// Add any code here that needs to be executed once the windowController has loaded the document's window.
[urlString setStringValue:defaultHP];
[[webView mainFrame] loadRequest:
[NSURLRequest requestWithURL:
[NSURL URLWithString:defaultHP]]];
[webView setUIDelegate:self];
[webView setGroupName:@"MyDocument"];
[webView setFrameLoadDelegate:self];


- (NSData *)dataRepresentationOfType:(NSString *)aType
// Insert code here to write your document from the given data. You can also choose to override -fileWrapperRepresentationOfType: or -writeToFile:ofType: instead.
return nil;

- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType
// Insert code here to read your document from the given data. You can also choose to override -loadFileWrapperRepresentation:ofType: or -readFromFile:ofType: instead.
return YES;

- (IBAction)connectURL:(id)sender{
[urlString setStringValue:[sender stringValue]];
[[webView mainFrame] loadRequest:
[NSURLRequest requestWithURL:
[NSURL URLWithString:
[sender stringValue]]]];

- (id)webView
return webView;
- (WebView *)webView:(WebView *)sender
(NSURLRequest *)request
id myDocument = [

[[[myDocument webView] mainFrame]

return [myDocument webView];

- (void)webViewShow:(WebView *)sender
id myDocument = [[NSDocumentController
[sender window]];
[myDocument showWindows];
- (void)webView:(WebView *)sender
(WebFrame *)frame

// Only report feedback for the main frame.
if (frame == [sender mainFrame]){
NSString *url = [[[
[frame provisionalDataSource]
request] URL] absoluteString];

[urlString setStringValue:url];

defaultHP = homepage;
-(NSString *)getDefaultHomepage{
return defaultHP;