Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
How to add html and body to a WebKit WebView's frame if they're not in the HTML?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="petruza" data-source="post: 1286525" data-attributes="member: 211951"><p>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.</p><p>I also manipulate the DOM on the body.</p><p>But what do I do when the HTML doesn't have this tags defined?</p><p>I can't modify the HTML file as it's user-provided.</p><p>I tried [DOMDocument createElement:] and [DOMDocument appendChild:] to insert a html, a head and a body, but didn't work.</p><p>How should this be done?</p></blockquote><p></p>
[QUOTE="petruza, post: 1286525, member: 211951"] 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? [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
How to add html and body to a WebKit WebView's frame if they're not in the HTML?
Top