I have 5 different website links. Of the five links, I want to make 1 link which when I click on the link it will automatically open 1 particular website out of 5 website links that I have. I've tried using the script, but I don't know how to create a link from the script.
The script opens the link in a new tab. But to do that I have to include the script in the web page and other people have to open the web page first before they can click the script button. What I want is to create a link so I can pass it on to others without having to open the website first
Can anyone provide a solution?
<script type="text/javascript">
var urls = new Array();
urls[0] = "a.com";
urls[1] = "b.com";
urls[2] = "c.com";
urls[3] = "d.com";
urls[4] = "e.com";
var random = Math.floor(Math.random()*urls.length);
window.location = urls[random];
</script>
If you want to only pass a link, you need to create a web server that you can give the link to and the web server will redirect to one of those links.