Skip to content

feature request: protocol api example #1364

@SimonSiefke

Description

@SimonSiefke

Electron fiddle already has lots of great examples for using different electron apis. I'm thinking a protocol api example could be a useful addition to the Electron fiddle examples.

Based on the electron documentation, this is how the example could look like:

const { app, BrowserWindow, protocol } = require('electron')


function createWindow () {
  const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {}
  })
  mainWindow.loadURL('some-protocol://index.html')

}


app.whenReady().then(() => {
  protocol.handle('some-protocol', () => {
    return new Response(
      Buffer.from('<h1>Hello from protocol handler</h1>'), // Could also be a string or ReadableStream.
      { headers: { 'content-type': 'text/html' } }
    );
  });

  createWindow()
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy