Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix the bug of reload looping

  • Loading branch information...
commit 232f42149e25204a4928d4303fdcc6422262fcfd 1 parent e009718
@jason2506 jason2506 authored
Showing with 7 additions and 6 deletions.
  1. +7 −6 extension/scripts/background.js
View
13 extension/scripts/background.js
@@ -7,15 +7,16 @@
// }
// });
// });
-var original_tab_url = ''
-function checkForValidUrl(tabId, changeInfo, tab) {
- if (tab.url != original_tab_url){
- if (tab.url.indexOf('www.facebook.com/pages/') > -1 || tab.url.indexOf('www.facebook.com/events/') > -1){
+var original_tab_url = {};
+var checkForValidUrl = function (tabId, changeInfo, tab) {
+ if (tab.url != original_tab_url[tabId]) {
+ if (tab.url.indexOf('www.facebook.com/pages/') > -1 ||
+ tab.url.indexOf('www.facebook.com/events/') > -1) {
chrome.tabs.reload(tab.id);
}
- original_tab_url = tab.url;
+ original_tab_url[tabId] = tab.url;
}
-};
+}
chrome.tabs.onUpdated.addListener(checkForValidUrl);
Please sign in to comment.
Something went wrong with that request. Please try again.