javascripthtmlwebhyperlinkhttpbackend

how to stop people from sharing your website page link?


Is there a way for to make a page link on my website non-shareable, that is, if I share a link to this page with anyone else will not be able to access it, it can only be accessed from the source


Solution

  • If you have a URL to the website you want it to be accessed from, you can check before you load the page if they came from it, if they didn't just close the tab or something, or display a message.

    var oldURL = document.referrer;
    if(oldURL!="YOURSITEURL.COM"){
       location.replace("WHEREVER.COM")
    }