javascript - MathJax removes all body content in UIWebView -
I'm trying to create a class method that will take the Mathjacks string, wrap the required HTML around it and load it one The specified UIWebView is my code below:
+ (zero) LoadMathJax: (NSString *) Webview in jax: (UIWebView *) webview font size: (int) fontisms {NSString * mathJaxPath = [[NSBundle MainBundle] pathForResource: @ "MathJax" type: @ directory in "JS": @ "Mathjax"]; NSString * htmlContent = [NSString stringWithFormat: @ "" @ "& lt; html>
Head & gt;" @ "& Lt; Meta name = 'viewport' content = 'initial-scale = 1.0' / & gt; @ "& Lt; style type = 'text / css' & gt; @" body {background color: transparent; Font-size:% d; Color: black;} "@" & lt; / Style> "@" & lt; Script type = 'text / javascript' src = '% @? Config = TeX-AMS-MML_HTML and MML-full '& gt; "@" & lt; / Head> from "@" to & lt; Body & gt; \\ (% @ \\) & lt; / Body & gt; "@" & lt; / Html> ", font size, Mathjaxpath, jacks]; NSLog (@"% @ ", htmlContent); [WebView Load HTML String: html Contact baseURL: [NSUr File URLWithPath: mathJaxPath]];} If I use this method, then NSLog shows the correct HTML (e.g. & lt; body & gt; \ (z_1 = 4 + 2i \) & lt; / body & gt; ; ), but the web view in the simulator is empty Use of Safari Web Inspector indicates that everything has been removed from the & lt; body & gt; tag.
Whatever I tried Use:
- Use MathJax CDN instead of loading it locally. No difference.
-
\\ (% @ \\)Replace with thetest text(i.e., remove the manjackex tag). There is no content between& lt; body & gt;tags on the go. / Li> - MathJax
& lt; script & gt;Remove the call now shows text, but is not provided as math. - From mathJaxpath to < Change the code> zero to
baseURL:. no gap.
It worked I finished closing for MathJax & lt; / Script & gt; Forgot the tag.
Comments
Post a Comment