I'm writing a chrome app which loads an external site via . Executing JavaScript within the loaded page does well with:
webview.executeScript();
But now I need to read the HTML-Content from that loaded external site in my main chrome app.
How can I achieve this?
I'm writing a chrome app which loads an external site via . Executing JavaScript within the loaded page does well with:
webview.executeScript();
But now I need to read the HTML-Content from that loaded external site in my main chrome app.
How can I achieve this?
Share Improve this question asked Jun 6, 2014 at 20:09 seokaiseokai 235 bronze badges 2- Inject a content script, establish messaging between the two? – Xan Commented Jun 6, 2014 at 20:11
- Hi Xan, can you please provide a code example or tutorial? – seokai Commented Jun 8, 2014 at 9:35
1 Answer
Reset to default 11You can use executeScript for that too:
webview.executeScript(
{code: 'document.documentElement.innerHTML'},
function(results) {
// results[0] would have the webview's innerHTML.
});