Sunil Dhillon
Sunil Dhillon

Reputation: 23

Refresh Browser tab in the background (Python script)

This may not be the right platform to ask to ask this question.

I was looking for an application that refreshes a particular tab in the browser so that I can be shown online on a particular website (Which requires refreshing page to show you online).

I have encountered some chrome and firefox apps which automatically refreshes a tab. But none of them do it in the background.

I have little knowledge of python and want to write my own script to do in the background. Any leads?

Upvotes: 0

Views: 1629

Answers (1)

Yoichiro Tanaka
Yoichiro Tanaka

Reputation: 925

First, you have to write your extension with JavaScript. And, you can reload the web page in the active tab every a minute in background by the following script:

chrome.alarms.onAlarm.addListener((alarm) => {
    chrome.tabs.getCurrent((tab) => {
        chrome.tabs.reload(tab.id);
    });
});

// Creating a new Alarm at a good timing (ex. the user clicks a start buttn).
chrome.alarms.create({periodInMinutes: 1});

BTW, you can get a chrome extension template with Yeoman generator.

Upvotes: 1

Related Questions