Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

215
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!