Home > Enterprise >  Access website Y only after you are redirected from website X
Access website Y only after you are redirected from website X

Time:10-11

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 enter image description here

CodePudding user response:

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

CodePudding user response:

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

  • Related