Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transfer/synchronize WebExtension data between Firefox Desktop and Firefox Android

I'm making a WebExtension (for Firefox) that tracks lists for the user. The user can add/remove elements from a list, or switch an element from one list to another, which means the extension needs the most recent version of the lists to work with.

So to be used on both desktop and Android, the extension needs to transfer/synchronize some data (which can be stringified).

I'm trying to find a way for the user to do it as simply as possible, without using external services.

The ideal solution for that (completely transparent for the user) would be to use storage.sync, but although it does synchronize between devices, it doesn't (yet) sync between normal Firefox (desktop) and Firefox for Android (implementation tracked at https://bugzilla.mozilla.org/show_bug.cgi?id=1316442).

Another solution would be to use the bookmarks API, but it's not supported by Firefox for Android (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/bookmarks) either.

That leaves me with two solutions that I can see:

  1. Letting the user save/retrieve the data to/from a local file, which means they need to copy the file to the other device (that's what I have in place right now).

  2. Saving/retrieving the data to/from a third-party server (which means I would have to create a server, and have the user make an account on it).

Is there any other solution that I'm missing?

like image 945
lullabee Avatar asked Dec 11 '18 18:12

lullabee


People also ask

Why are my Firefox bookmarks not syncing?

Make sure you are signed in with the same Firefox account and that bookmark syncing is turned on for both mobile and desktop. If the issue still persists, sign out of your Firefox account and sign back in, making sure that bookmark syncing is enabled. All done.


1 Answers

According to this support document, the following data is synced from/to Android: bookmarks, history, open tabs, form information and passwords.

This chart shows which web extension APIs are supported on Android:

  • Bookmarks: no API yet on Android
  • History: no API yet on Android
  • Tabs: API supported. Extensions that should occasionally or one-time sync could implement a manual process (this is a useless flow for OP as the question describes a flow where syncing should occur often):
    • Open a tab with a web-extension or data URL with sync data in the query parameters. In this tab, display some text asking the user to open Firefox on the other device. Keep a record that you opened this tab locally using sessionStorage.
    • When the tab is opened on the other device and the sessionStorage is missing, get the sync data from the query parameters and display a message that the data was synced and that both tabs can now be closed.
  • Form information: no API yet
  • Passwords: no API yet

Not mentioned in this list, but also synced is BrowserSettings. It allows overwriting some fields that are synced (homepageOverride, newTabPageOverride), but those fields have to be defined in manifest.json so they cannot be dynamic. Also, it would probably interfere with normal functioning.

In conclusion: wait for browser support or pick a server solution.

like image 113
Blaise Avatar answered Oct 10 '22 04:10

Blaise