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

113
Views
Javascript Bluetooth API Not Finding My Device

I'm trying to find my device listed under the bluetooth options when I am trying to use the Javascript Bluetooth API, but my device John's iPhone is not showing up for me to pair with. Really new at this, so was hoping to get some help on this issue.

I've linked the code below. All I see is null and unknown devices that fail to connect.

document.querySelector('form').addEventListener('submit', function(event) {

  event.preventDefault();

  onButtonClick();
});

function onButtonClick() {
  const options = {
    "acceptAllDevices": true
  }

  navigator.bluetooth.requestDevice(options)
    .then(device => {
      log('> Name:             ' + device.name);
      log('> Id:               ' + device.id);
      log('> Connected:        ' + device.gatt.connected);
    })
    .catch(error => {
      log('Argh! ' + error);
    });

}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <form>
    <button type="submit">Submit</button>
  </form>

  <script src="./index.js"></script>
</body>

</html>

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Its console.log() instead of log()

Example:

...
  navigator.bluetooth.requestDevice(options)
.then(device => {
  console.log('> Name:             ' + device.name);
  console.log('> Id:               ' + device.id);
  console.log('> Connected:        ' + device.gatt.connected);
})
.catch(error => {
  console.log('Argh! ' + error);
...
about 4 years ago · Santiago Gelvez 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!