UIWebview :: Text :: HTML :: JS
<p><br>
1- i load a text from a txt file<br>
2- i show it into a html "file" 
3- problem :<br>
3-a : this code works :<br>
i create my page by code and i insert my text</p>

<pre><code>myText = ... loaded from an array of texts ...;
 NSString *myDescriptionHTML = [NSString stringWithFormat:@"&lt;html&gt; \n"
 "&lt;head&gt; \n"
 "&lt;style type=\"text/css\"&gt; \n"
 "body {font-family: \"%@\"; font-size: 1.0f + 'em'; color:#FFF;}\n"
 "&lt;/style&gt; \n"
 "&lt;/head&gt; \n"
 "&lt;body id=\"myid\"&gt;%@&lt;/body&gt; \n"
 "&lt;/html&gt;", @"Arial", myText];
 [self.myWebView loadHTMLString:myDescriptionHTML baseURL:nil];
</code></pre>

<p>3-b but this one does not work :<br>
i load a html page already created and i inject my text into using JS :</p>

<pre><code>myText = ... loaded from an array of texts ...;
 [self.myWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.getElementById(\"myid\").innerHTML = \"%@\";", myText]];
</code></pre>

<p>3-c but this one working :<br>
same as 3-b but i init my text with a string in the code itself : </p>

<pre><code>myText = @"hello all";
 [self.myWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.getElementById(\"myid\").innerHTML = \"%@\";", myText]];
</code></pre>

<p>any help to understand what's wrong with 3-b ?</p>

<p>thank you</p>
