【问题标题】:Chrome Packaged app communication with webpageChrome 打包应用程序与网页通信
【发布时间】:2014-04-16 03:00:30
【问题描述】:

我使用了 Chrome-Serial-App-master 的 chrome 打包应用程序 enter link description here

Manifest
"app": {
    "background": {
        "scripts": [
            "main.js"
        ]
    }
},
"permissions": [
    "serial"
]

我想在文本框区域接收从打包应用到我网站的价值 我可以访问我的网页 Dom 吗?
或使用消息传递?

【问题讨论】:

    标签: google-chrome google-chrome-app


    【解决方案1】:

    不确定我是否理解这个问题,但您可以使用 XMLHttpRequest 读取任何网页的 HTML,然后通过设置某些元素的 innerHTML 属性来显示它。

    【讨论】:

      【解决方案2】:

      您可以使用消息传递。为此,您可以使用 chrome.runtime.onMessageExternal 或 chrome.runtime.onConnectExternal chrome API。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-03-09
        • 2016-11-25
        • 1970-01-01
        • 2016-08-06
        • 2013-04-07
        相关资源
        最近更新 更多