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

145
Visualizações
link tag redirect issue in react.js

I have links saved in the firebase DB, when I click "save" the link it will updated but when I click to the link icon it redirect me to home page. Example: The link in the DB is "www.instagram.com", when I click the icon it will redirect me to the home with this url "localhost:3000/www.instagram.com", but when I do the console log it logs only "www.instagram.com", can somebody help me please?

formInputs it's a simple object

<a
    target="_blank"
    href={formInputs.ig}
    onClick={() => {
        console.log(formInputs.ig);
    }}
>
    <FontAwesomeIcon
        className="icons"
        icon={faInstagram}
        color="purple"
        size="2x"
    />
</a>

I tryed to use the Link component from react-router-dom but it do the same thing

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

0

In short: please try to use a full absolute URL together with the protocol. Instead of a short one. In this case, can change the value to https://www.instagram.com.

Document source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a

Possible values of href:

  • An absolute URL - points to another website (like href="http://www.example.com/default.htm")
  • A relative URL - points to a file within a website (like href="default.htm")

The key difference is the // at the beginning. Without it, your browser is considering your given "www.instagram.com" as a relative URL and is trying to calculate the path based on your current location.

And if you're only using //www.instagram.com, the browser will use the same protocol as the current page, e.g. http://localhost -> http://www.instagram.com

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