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

289
Visualizações
Access website Y only after you are redirected from website X

I have a slightly strange question and I'm not sure if this could be achieved at all but anyway I'm curious to try.

I have 2 sites that are independent, lets say www.site1.com and www.site2.com. site2 will be placed in a href in site1. The question is - is it possible site2 to be accessible only after the user is redirected to it from site1 and if the user tries to open site2 directly or thru an a href from another site different then site1 to not be able to access it?

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

0

Check for:

window.document.referrer
// Empty if User is directly loading page.

The value is an empty string if the user navigated to the page directly (not through a link, but, for example, by using a bookmark). Because this property returns only a string, it doesn't give you document object model (DOM) access to the referring page.

MDN Documentation: https://developer.mozilla.org/en-US/docs/Web/API/Document/referrer

Browser Support:

enter image description here

about 4 years ago · Juan Pablo Isaza Relatório

0

You can check for a post parameter that you set from the website 1 redirection (either through a form or plain javascript). And then set a local storage variable to check for when loading site 2.

Local storage doc

JavaScript post request like a form submit

But keep in mind this can be easily bypassed with enough html/js knowledge.

To ensure that only your website can make post parameter, you could maybe (not sure about me there): generate code (used as post parameter) on the go from webserver 1 and send them to webserver 2 at the same time (or a little before) to ensure the code received by the server 2 is really generated at server 1

about 4 years ago · Juan Pablo Isaza Relatório

0

Depending on the backend server you are using, you can use something called REFERRER details that will be there in the http header of the request ( for your www.site2.com page for example). This REFERRER will have the information on who referred the user to this site. You can add a condition something like if REFERRER is www.site1.com then render the page .

Here is a link to start with https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer

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