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

127
Visualizações
Express.js doesn't redirect to custom URL scheme

I'm currently trying to redirect the user to a custom URL scheme with Express.js to open an app installed on my iPad (using "example://").

Here's my code that should redirect to the URL when a button gets pressed on a page running on a different server:

const { response } = require('express');
const express = require('express');
const router = express.Router();
const path = require('path');
const smartMirror = express();


router.get('/', function(req, res){
    res.sendFile(path.join(__dirname + '/test.html'));
});

smartMirror.use('/', router);
smartMirror.listen(process.env.port || 8000);

console.log('Running on Port 8000');

smartMirror.get("/launch", (req, res) => {
    res.redirect(302, "touchpoint://");
    res.status(200);
})

In the console the error says "UnhandledPromiseRejectionWarning: TypeError: node-fetch cannot load [object Request]. URL scheme "touchpoint" is not supported."

What's the problem here?

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

0

You've misidentified the problem. It hasn't go anything to do with Express telling the client it has been redirected, it is because you are trying to access the URL with fetch.

Whatever application touchpoint:// has been registered to be handled with, you need to navigate to the URL.

fetch("touchpoint://") won't work (and this is what you are doing, just via a redirect).

This is for much the same reason that <img src="touchpoint://"> wouldn't work if you tried that.

You need to actually navigate to it. e.g.

<a href="touchpoint://"> or location = "touchpoint://".

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