Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

234
Visualizações
window.open('my-app://', '_blank'); does not launch desktop app from the browser, but going to my-app:// in the browser does

If I open Chrome and type in my-app:// in the URL / search bar, and press enter, Chrome displays a dialog box that says "Open my-app? A website wants to open this application". I can click ok and my Electron app opens.

I have a React app and I want to add the same functionality, that programatically prompts the user to launch the application via an alert. I have tried adding window.open('my-app://', '_blank') which opens a dialog, but it is not the same as the other dialog and when I click ok, I am told by Chrome that is has blocked a pop-up, and the app does not open. I have also tried using window.location.href = 'my-app://', but it does not work. In the console I get the error: "Failed to launch 'my-app://' because the scheme does not have a registered handler."

How do I present the user with a prompt / alert that when ok is clicked will launch my app, just like it does when I enter my-app:// manually in to the browser?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Try document.location, this works for opening VS Code.

function openVSC() {
  document.location = 'vscode://open?url=';
}
<button onClick="openVSC()">Open VS Code</button>

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda