Is it possible to programmatically check if Chrome Sync is configured in Google Chrome?
The reason I ask is that I am coding an Extension for Chrome that depends on Chrome Sync, and would like to check/inform the user if it's not configured.
Before posting this question I checked the obvious places (Chrome Extension APIs, StackExchange, and Google), but so far I haven't had any luck.
If anyone has an idea/solution I'd appreciate the help.
Cheers.
In the About tab, you can find "Last Synced", if it shows "Just Now" you can be sure that the sync process completed just now, and be sure that everything has been synced. There is one more field "Syncing" which shows the status of sync, if its true it means the syns is being done and you should wait.
Google Chrome lets you sync your bookmarks and extensions so you don't have to add or transfer them to your other computers.
Google has a page to see the status of your synced account; the URL of that page is https://www.google.com/settings/chrome/sync
. Something you can do to see if an account is synced is opening that status page using cross-domain connections that Google allows for extensions (if it doesn't even return 200-OK status is not synced) and then you use a little JavaScript to extract the "Last Sync" date from that page; after that just save it using the chrome.storage.sync
API and then a few seconds later check again the "Last Sync" date, if it changed then you can be 99% sure is synced (or if you want to cover the case of slow synchronizations just use setInterval
to wait for it).
You can use the following JavaScript to extract the date:
NodeList.prototype.forEach = Array.prototype.forEach;
var date = null;
document.querySelectorAll("*").forEach(function(ele){
var matches = ele.innerText.match(/\b\d{4}\s\d{2}:\d{2}:\d{2}\b.*/);
if (matches) date = matches[0];
});
The first time you save that value
chrome.storage.sync.set({date: date});
And the second time you should compare both values adding something like this:
chrome.storage.sync.get("date", function (old) {
if (date !== old) {
// Is sync!
} else {
// not sync.
}
});
Good luck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With