- From: Brett Zamir <notifications@github.com>
- Date: Fri, 03 May 2019 23:46:31 -0700
- To: w3c/IndexedDB <IndexedDB@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/IndexedDB/issues/264@github.com>
I am wondering if, in place of the perhaps intimidating suggestion brought up through #75, an easier bridge forward to site-agnostic databases might be to tie the privilege to `registerProtocolHandler`. A special format, such as extending (or replacing) the `web+` prefix, e.g., `web+indexeddb+`, might signify a protocol handler which also would grant access to a shared database as well. So a site might request permissions like this: ```js navigator.registerProtocolHandler( "web+indexeddb+com_example_dbformats_cdcollection", "https://cds.example.com/?collection=%s", "CD collection browser" ); ``` The variable `%s` need not be present, but it might be used to allow such as flagging a default store or view of the collection for the site to open, e.g., `web+indexeddb+com_example_dbformats_cdcollection:folk-genre`. The user would then be asked whether they wished to add `cds.example.com` as a handler for `web+indexeddb+com_example_dbformats_cdcollection` links and also be able to create or access a shared `com_example_dbformats_cdcollection` database (potentially informing the user of any other sites which had already registered for this database format). If the user approves the protocol, the site could then begin using a shared database (and create the database if the site--or another site--has not already created one) by: ```js const req = indexedDB.open('com_example_dbformats_cdcollection', undefined, { shared: true }); ``` (If the protocol access had *not* yet been created, this might throw or be a no-op.) The existing UI for storing approved protocols could thus be leveraged. If there is concern that a user might already have approved such a protocol before knowing it can now support shared database creation/access, the protocol name, e.g., `web+indexeddb+` might have reserved characters would not be permissible in the current scheme. While there are of course different uses for web protocols and shared databases, I think they may be considered similar enough in both handling custom formats to justify the latter leveraging the former. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/IndexedDB/issues/264
Received on Saturday, 4 May 2019 06:46:52 UTC