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

144
Views
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?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

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

over 4 years ago · Santiago Trujillo Report

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

over 4 years ago · Santiago Trujillo Report

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

over 4 years ago · Santiago Trujillo 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!