Domness
Domness

Reputation: 7605

Loading HTML into a Cocoa app with WebView and change text

Right, so far I've got this for loading up a HTML file from within my app:

NSString *path1 = [[NSBundle mainBundle] pathForResource:@"file" ofType:@"html"];
NSString *html = [NSString stringWithContentsOfFile:path1 encoding:NSUTF8StringEncoding error:nil];
[[webView mainFrame] loadHTMLString:html baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]bundlePath]]];

Which works loading the file up into the app's WebView. But I want to change some values in the HTML (or PHP if it works by using $_REQUEST/$_GET), for example, I have a table with some text in it and I want to change this text from an NSString etc.

How would I go about this?

Upvotes: 0

Views: 1282

Answers (1)

Nickolay Olshevsky
Nickolay Olshevsky

Reputation: 14160

You can execute JavaScript on UIWebView, if you need to do that dynamically. Or, if you want to refresh the whole page, you can modify string loaded from file according to your preferences.

Upvotes: 1

Related Questions