how I change the URL that will be loaded according to document.referrer

  javascript

I need the user to be directed to a certain URL according to the website he came from.

<script>
    function abc(){
    var ref = document.referrer;
    if (ref = /site1/) {
    window.location.href = "https://www.site1.wow";
    } else if (ref = /site2/) {
    window.location.href = "https://www.site2.wow";
    } else {
    window.location.href = "https://www.site.wow";
 }
}
</script>

Source: Ask Javascript Questions

LEAVE A COMMENT