When I load an HTML in a WebView, and the HTML has explicit <head>
and <body>
, I can get the head and insert a link to inject some CSS styles to the document on the fly.
[DOMDocument createElement:]
and [DOMDocument appendChild:]
to insert a html, a head and a body, but didn't work.
How should this be done?You could read the contents of the DOMDocument into an NSMutableString and append it then before loading the web view from this string...
精彩评论