Redirect depending on referrer

node v10.24.1
version: 1.0.0
endpointsharetweet
exports.endpoint = (request, response) => { response.end(`<script> const ref = document.referrer; const redirect = url => { window.alert(\`You will be redirected to\n${url}\`); window.location.href = url; }; if (-1 !== ref.indexOf('WNNJJrm') || -1 !== ref.indexOf('slack.com')) redirect('https://www.iana.org/'); else if (-1 !== ref.indexOf('NWWMMGe') || -1 !== ref.indexOf('google.com')) redirect('https://www.ietf.org/'); else window.alert(\`Unknown referrrer\n(${ref})\`); </script>`); };
Loading…

no comments

    sign in to comment