Gulp refresh active tab after changing code in chrome extension

I am developing a chrome extension and I want to automatically update the active tab after changing the code

I got gulp -open to work, so I no longer need to go to chrome: // extensions and manually click "reload"

now only the active tab update is left

I tried gulp-livereload but couldn't get it working to develop the chrome extension

any ideas how to approach this?

+5
source share
1 answer

Could you send your chrome extension code? Without a lot of information, I hope this will be useful. You can enter the code below to refresh the page after chrome reloads:

chrome.tabs.query({ active: true, // Select active tabs lastFocusedWindow: true // In the current window }, function(tabs) { // Since there can only be one active tab in one active window, // the array has only one element var tab = tabs[0]; // Javascript to reload the page var code = 'window.location.reload();'; // Execute the code for the current tab chrome.tabs.executeScript(tab.id, {code: code}); }); 
+2
source

Source: https://habr.com/ru/post/1238453/


All Articles