Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

xcode - WebView load HTML page with all resources from a local directory

I am developing a COCOA application. It's a requirement of the application to load HTML page from a local directory. The HTML page includes links to many resources such as images, JavaScript, XML and CSS file. Hence it's more like a local website without any server. How can I achieve this using WebView control? I am developing application for Mac OS X.

Any help would be highly appreciated, Farooq-

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can simply use this code -

[[yourWebView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:pathOfLocalWebPage]]];

Hope this helps :)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...