S
S
sHARek2018-08-02 17:16:16
Google Chrome
sHARek, 2018-08-02 17:16:16

Pass received data to extension "page"?

<!doctype html>
<html>
    <head>
        <title>Test</title>
    <script type="text/javascript" src="jquery.js"></script>	
    </head>
    <body>
        <h1 style="width:200px; text-align:center;">Test</h1>
        <div id="data"></div>
    </body>
</html>

is the
5b63109d2a423333701154.jpeg
Manifest page
{
  "manifest_version": 2,
  "name": "Test",
  "description": "Тест расширения",
  "version": "1.1",
  "icons": {
    "128": "128.png"
  },
  "browser_action": {
        "default_popup": "index.html"
    },
  "permissions": [
    //"tabs",
    "activeTab"
    ],
  "content_scripts": [
  {
    //"matches": ["http://*/*"],
    "matches": ["https://www.yandex.ru/"],
    "css": ["style.css"],
    "js": ["jquery.js","popup.js"]
  }
  ]
}

js file popup.js
$(document).ready(function() {
  $("#какой-то iD").text(); // допустим получаю текст из тега на yandex.ru
});

How can I now transfer the received text to my extension page (Fig. 1), for example, in divwith id="data"?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2018-08-02
@Stalker_RED

https://developer.chrome.com/extensions/messaging#...
Examples: https://stackoverflow.com/questions/12265403/passi...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question