docs: migration guide for register{StandardSchemes => SchemesAsPrivileged} (#16762)
* docs: migration guide for register{StandardSchemes => SchemesAsPrivileged} cc @nitsakh * Update docs/api/protocol.md Co-Authored-By: nornagon <nornagon@nornagon.net> * Update docs/api/protocol.md Co-Authored-By: nornagon <nornagon@nornagon.net> * Update protocol.md * Update docs/api/protocol.md Co-Authored-By: nornagon <nornagon@nornagon.net>
This commit is contained in:
parent
01c442de64
commit
5a44cc50cf
1 changed files with 16 additions and 0 deletions
|
@ -75,6 +75,22 @@ By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB, co
|
||||||
are disabled for non standard schemes. So in general if you want to register a
|
are disabled for non standard schemes. So in general if you want to register a
|
||||||
custom protocol to replace the `http` protocol, you have to register it as a standard scheme.
|
custom protocol to replace the `http` protocol, you have to register it as a standard scheme.
|
||||||
|
|
||||||
|
`protocol.registerSchemesAsPriviliged` can be used to replicate the functionality of the previous `protocol.registerStandardSchemes`, `webFrame.registerURLSchemeAs*` and `protocol.registerServiceWorkerSchemes` functions that existed prior to Electron 5.0.0, for example:
|
||||||
|
```
|
||||||
|
# before (<= v4.x)
|
||||||
|
// Main
|
||||||
|
protocol.registerStandardSchemes(['scheme1', 'scheme2'], { secure: true })
|
||||||
|
// Renderer
|
||||||
|
webFrame.registerURLSchemeAsPrivileged('scheme1', { secure: true })
|
||||||
|
webFrame.registerURLSchemeAsPrivileged('scheme2', { secure: true })
|
||||||
|
|
||||||
|
# after (>= v5.x)
|
||||||
|
protocol.registerSchemesAsPriviliged([
|
||||||
|
{ scheme: 'scheme1', privileges: { standard: true, secure: true } },
|
||||||
|
{ scheme: 'scheme2', privileges: { standard: true, secure: true } },
|
||||||
|
])
|
||||||
|
```
|
||||||
|
|
||||||
### `protocol.registerFileProtocol(scheme, handler[, completion])`
|
### `protocol.registerFileProtocol(scheme, handler[, completion])`
|
||||||
|
|
||||||
* `scheme` String
|
* `scheme` String
|
||||||
|
|
Loading…
Reference in a new issue