0

I'm trying to display a set of strings to a webview, I know it can be done, I try to create my own html for it,

[contentWebView loadHTMLString:[NSString stringWithFormat:@"<html><head><link rel=\"stylesheet\" href=\"default.css\" type=\"text/css\" /><script type=\"text/javascript\" src=\"default.js\"></script></head><body%@>%@</body></html>", cssFontSizeOverride, webcontent] baseURL:nil];

but the result, it never show anything, I'm just having a blank page. Any one know how to troubleshoot this? Thanx in advance.

Viken Ong
  • 109
  • 2
  • 10

2 Answers2

0

You're referencing external resources with relative URLs (default.css, default.js). Those can only be loaded if you provide a base URL.

omz
  • 53,243
  • 5
  • 129
  • 141
  • as for the base URL, what should I input in it? Is there any specific link I need to put? – Viken Ong May 12 '11 at 01:07
  • Depends on where your resources are located. If you have them locally, you could create a file URL with [NSURL fileURLWithPath:...]. – omz May 12 '11 at 19:54
0

Have a look at:

Community
  • 1
  • 1
Nick Weaver
  • 47,228
  • 12
  • 98
  • 108