Chrome extension to reload page when loading failed

Since it is not possible to use Greasemonkey for this , I want to write a Chrome extension that will reload the page if it was not able to load initially.

I know how to write a Chrome extension, I have already introduced scripts and figured out how to communicate with pages, so I have basic knowledge of how tabs work and how to build my manifest.

What events am I looking for and how can I make it work for both GET requests and POST?

+4
source share
1 answer

Use chrome.webNavigation.onErrorOccurredor chrome.webRequest.onErrorOccurredto detect navigation errors. These APIs cannot be used in script content, so you need to add a help page or an event page to your extension.

I recommend using the API webNavigationbecause they can also be used with event pages (as opposed to the API webRequest). Here is an example, use instead to get what you want. chrome.tabs.reloadchrome.tabs.update

+6
source

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


All Articles