How to reload certain tab in chrome extension

I am trying to reload a page that a user may have open in one of their tabs from popup (specifically popup.js). I am looking at this answer but it is only for the current tab

Also when it runs I get this error:

popup.html:1 Unchecked runtime.lastError while running tabs.executeScript: Cannot access contents of url "".
Extension manifest must request permission to access this host at Object.callback (chrome-extension://mjckbfpnokoplldjpijdfhffbbbfflah/popup.js:3:17)

I have added

"permissions": [

inside my manifest, still no luck. How would I be able to do it for a specific tab that the user has open. I want this to reload the website the first time the extension is loaded so the the user does not have to reload the webpage manually to have the content script take effect. Thanks!



For fixing execute error you need to change permissions in your manifest file to:

  "permissions": [

You can query ID of the tab by url like this:

chrome.tabs.query({url: "*"}, function(tab) {
   // reload tab with one of the methods from linked answer


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.