|
|
#1 |
|
Loading local HTML file via IBAction in WebView
Hi
I'm trying to make a button load a local HTML file in a webView on my OSX App. My current code is: Code:
- (IBAction)returnHome {
[webView setUIDelegate:self];
NSURL *url = [[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html"];
NSString *html = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil];
NSURL *baseUrl = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]];
[[webView mainFrame] loadHTMLString:html baseURL:baseUrl];
}
Sorry if this is in the wrong place - I wasn't sure where to put it. Thanks in advance, Sam |
|
|
|
0
|
|
|
#2 | |
|
Quote:
[WebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"] isDirectory:NO]]]; |
||
|
|
0
|
|
|
#3 |
|
Oh shoot...
Ah ok - that's for iOS. Does anybody know how I would change that for OSX? The documentation for webView methods on Apple looks pretty similar for both iOS and Mac OSX.
Sam |
|
|
|
0
|
|
|
#4 | |
|
Are you sure?
The iOS class is UIWebView. That's not the same as WebView. Quote:
If you can't figure it out from the class reference doc, please explain exactly which part you're having trouble with. |
||
|
|
0
|
![]() |
|
| Tags |
| html, local, objective-c, webview |
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| thread | Thread Starter | Forum | Replies | Last Post |
| Local HTML files on an iphone | sakraft1 | iPhone Tips, Help and Troubleshooting | 1 | Mar 8, 2010 02:16 PM |
| load local html into UIWebView | knut | iPhone/iPad Programming | 5 | Jul 8, 2009 01:30 PM |
| Loading local HTML in UIWebView | North Bronson | iPhone/iPad Programming | 1 | Mar 17, 2009 04:57 AM |
| Calling local html file in WebView | TurboLag | Mac Programming | 3 | Jul 9, 2008 10:04 PM |
| How to get mobileSafari to load an HTML file stored locally on the device? | yacoub | Jailbreaks and iOS Hacks | 5 | Oct 16, 2007 09:43 PM |
All times are GMT -5. The time now is 12:09 PM.








Linear Mode

