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

216
Visualizações
Safari Web Extension Fails to Send Native Message

I'm trying to create a Safari Web Extension to my native app. I want to have a popup with a button which when clicked will communicate with my native app:

    browser.runtime.sendNativeMessage({message: "Open Main App"}, function(response) {
    console.log("Received sendNativeMessage response:");
    console.log(response);
    });

However, the app fails to receive the message sent from the Safari Web Extension:

    func beginRequest(with context: NSExtensionContext) {

    its the function that handles all things
    then
    
    if msg.contains("Open Main App") == true {
      print("NEED TO OPEN")
      guard let url = URL(string: "player:Vacation?index=1") else {
         return
      }
      NSWorkspace.shared.open(url)
    }

Safari log showed this error message:

  ReferenceError: Can't find variable: browser

What is wrong?

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

0

Did you use browser.runtime.sendNativeMessage from the background script? You also need to set the permission in the manifest file. Like so: "permissions": [ "nativeMessaging" ]

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