I have used hash urls for my website and made safari extension for the same. For login/logout my extension opens ourdmain.in in new tab and listens to update methods.
I have implemented chrome.tabs.onUpdated.addListener() to listen to tab updates and for chrome this is working fine but for Safari its not working properly.
I have implemented following method in my background.js:
chrome.tabs.onUpdated.addListener(function (tabID, changeInfo, tab) { console.log("Updated tab (" + tabID + ")=>>> " + tab.url); //chrome.tabs.sendMessage(tabID, { name: 'Chrome Tabs updated >>>>>> ' + tab.url }); if (tab.status == 'complete' && tab.url.startsWith(_config.baseURL + '/login?signedout=1')) { console.log('Clearing extension state!'); } if (tab.status == 'complete' && tab.url === _config.baseURL + '/dashboard?extension=1') { console.log("Login process"); } });
, only URL changes and page is refreshed but not totally reloaded. However, this works perfectly fine with Chrome.
标签:tabID,extension,URL,reloaded,but,chrome,url,tab,totally From: https://www.cnblogs.com/wingxyz/p/16890451.html