A
A
Arkady Baganin2018-02-03 17:14:42
JavaScript
Arkady Baganin, 2018-02-03 17:14:42

I don't get a message when I refresh a tab, what should I fix?

It is necessary that when updating a message is displayed on the screen!
Here are the scripts:
1. script.js

chrome.tabs.onUpdated.addListener(function () { 
alert('Hi');
});
var save = document.getElementById('save');
save.onclick = function(){
  chrome.tabs.executeScript( null, {"code": "var str; str = document.querySelector('html').innerHTML;"}, function(str) {
  alert(str);
  });
}

2.manifest.json
{
    "manifest_version": 2,
    "name": "Saver",
    "description": "Сохранит всё!",
    "version": "1.0",
    "browser_action": {      
        "default_popup": "popup.html"
    },

  "icons": { "16": "calc.png",
               "48": "calc.png",
               "128": "calc.png" },

  "permissions": [
        "tabs", "<all_urls>" 
    ]		   
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question