Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

109
Views
Is there a way to refresh a webpage from inside a Mozilla Firefox extension

I am currently working on developing a Mozilla Firefox extension that blocks ads to learn more JavaScript, HTML, and CSS. Within the extension of that popup, I want to be able to click a button and refresh whatever page the browser is currently on. I have the buttons developed, and are currently interactive, but I am failing to see how I can extend the scope from the HTML I am using to see the webpage the browser is on.

Here is the most simplified state I have working: popup.html

<!doctype html>
<hmtl>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width"> 
        <style>
            body {
                padding: 1em;
            }
            input {
                margin-left: 1em;
                margin-right: 1em;
            }
        </style>
    </head>
        <form>
            <input type="button" value="Refresh">
            <button onClick="document.location.href=window.location.href">Refresh Window</button>
            <button onClick="document.location.href = 'popup.html' + '?' + Date.parse(new Date());">Refresh Page</button>
        </form>
        <p>Page hasn't been refreshed</p>
        <script src="/popup1.js"></script>
</hmtl>

popup1.js:

const button = document.querySelector('input');
const paragraph = document.querySelector('p');
const mainBrowser = browser.document

button.addEventListener('click', refreshButton);

function refreshButton(){
    button.disabled = true;
    button.value="Refreshing"
    paragraph.textContent = 'Page is refreshing';
    // mainBrowser.reload();
  window.setTimeout(function() {
    button.disabled = false;
    button.value = "Refresh"
    paragraph.textContent = 'Page is up-to-date.';
  }, 1000);
}

Image of what extension ui looks like, on clicking icon

The goal is to be able to click the Refresh Page button in the extension, and it reload whatever website my browser is currently on. I'm very new to JS, CSS, and HTML, and am failing to access things outside the scope of my extension.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!