PDA

View Full Version : Load WebView from source string/data




ATG
Feb 27, 2007, 04:17 AM
I have some html source of a page I want to load into a WebView. However it is not in a file and so I can't just load from a URL. Is there any way to load a WebView directly from an NSString or NSData holding the source code?

Thanks for any help :)



robbieduncan
Feb 27, 2007, 05:01 AM
Get the main frame via the obvious method and use the loadHTMLString:baseURL: (http://developer.apple.com/documentation/Cocoa/Reference/WebKit/Classes/WebFrame_Class/Reference/Reference.html#//apple_ref/occ/instm/WebFrame/loadHTMLString:baseURL:) method.

That took me under 2 minutes to find in the documentation.

ATG
Feb 27, 2007, 05:46 AM
Get the main frame via the obvious method and use the loadHTMLString:baseURL: method.
Thanks :)

That took me under 2 minutes to find in the documentation.
Well good for you. I wasn't so fortunate