seokai
seokai

Reputation: 23

How to access webview content in chrome app

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?

Upvotes: 2

Views: 1641

Answers (1)

lazyboy
lazyboy

Reputation: 444

You can use executeScript for that too:

webview.executeScript(
    {code: 'document.documentElement.innerHTML'},
    function(results) {
      // results[0] would have the webview's innerHTML.
    });

Upvotes: 11

Related Questions