How to add html and body to a WebKit WebView's frame if they're not in the HTML?

Joined
Aug 16, 2011
Messages
1
Reaction score
0
Points
1
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.
I also manipulate the DOM on the body.
But what do I do when the HTML doesn't have this tags defined?
I can't modify the HTML file as it's user-provided.
I tried [DOMDocument createElement:] and [DOMDocument appendChild:] to insert a html, a head and a body, but didn't work.
How should this be done?
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top