aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/background/background.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/pages/background/background.js b/src/pages/background/background.js
index 2aa361fc..fc9503ff 100644
--- a/src/pages/background/background.js
+++ b/src/pages/background/background.js
@@ -172,9 +172,17 @@ function redirectOfflineInstance(url, tabId) {
if (!newUrl) newUrl = spotifyHelper.switchInstance(url);
- if (newUrl) browser.tabs.update(tabId, { url: `/pages/errors/instance_offline.html?url=${encodeURIComponent(newUrl)}` });
+ if (newUrl) {
+ if (counter >= 5) {
+ browser.tabs.update(tabId, { url: `/pages/errors/instance_offline.html?url=${encodeURIComponent(newUrl)}` });
+ counter = 0;
+ } else {
+ browser.tabs.update(tabId, { url: newUrl });
+ counter++;
+ }
+ }
}
-
+let counter = 0;
browser.webRequest.onResponseStarted.addListener(
details => {
if (!generalHelper.getAutoRedirect()) return null;