最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to access webview content in chrome app - Stack Overflow

programmeradmin0浏览0评论

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
Add a ment  | 

1 Answer 1

Reset to default 11

You can use executeScript for that too:

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

评论列表(0)

  1. 暂无评论