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:
Here as you can see, I am tracking logout and login events based on URL updates.
And on my wesite.in/login page when user is authenticated url will be changed to website.in/dashboard but page is not reloaded. And same happens for logout, website.in/dashboard url changes to website.in/login.
Here, only URL changes and page is refreshed but not totally reloaded. However, this works perfectly fine with Chrome.
Do we have any restriction over here for Safari? or can we have any solution?
If I reload page manually, update method works perfect but I don't want to reload full page, no my routing url should work here?
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:
Code Block 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"); } });
Here as you can see, I am tracking logout and login events based on URL updates.
And on my wesite.in/login page when user is authenticated url will be changed to website.in/dashboard but page is not reloaded. And same happens for logout, website.in/dashboard url changes to website.in/login.
Here, only URL changes and page is refreshed but not totally reloaded. However, this works perfectly fine with Chrome.
Do we have any restriction over here for Safari? or can we have any solution?
If I reload page manually, update method works perfect but I don't want to reload full page, no my routing url should work here?