Re: WebKit BaseURL problems
Re: WebKit BaseURL problems
- Subject: Re: WebKit BaseURL problems
- From: Peter Borg <email@hidden>
- Date: Wed, 28 Jul 2004 09:32:38 +0200
Hi!
Try it without stringByDeletingLastPathComponent, e.g.
/Users/jon/sites/index.html. Similar code to yours works for me if I
create the url with the whole path.
And remember "If path begins with a tilde, it must first be expanded
with stringByExpandingTildeInPath".
Regards,
Peter
On 2004-07-27, at 12.36, Jon Raphaelson wrote:
I searched in the archives for anything quite like this but I couldn't
find anything. Also, I'm sorry if this sounds newbish...
I am working an an HTML editor with live previewing. Basically I have
a Document Based app, with a textView and webView in the document
window. I want the webView to show the contents of the textView as a
webpage, with a baseURL of the documents path. This is what I have...
...
if([self fileName])
{
basePath = [[NSString alloc] initWithString:[[self fileName
stringByDeletingLastPathComponent]];
NSLog(@"basePath on open: %@", basePath);
}
...
...
NSURL *baseURL;
if(basePath != nil) baseURL = [[NSURL alloc]
initFileURLWithPath:basePath];
else baseURL = nil;
NSLog(@"baseURL: %@", baseURL);
[[webView mainFrame] loadHTMLString:[textView string] baseURL:baseURL];
Now the live preview works so long as baseURL is nil, but if I try and
use a NSURL that points to somewhere like 'Users/jon/Sites' then it
chokes. I get no error messages, just nothing rendered in the webview.
Any ideas?
Thanks ahead of time,
Jonathan Raphaelson
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.