Among your choices are the following options:
- Send all the URLs to the client and have the client pick a random choice.
- Have the server pre-pick the random URL and send only that one to the client (it can just be put directly into the
<a>
link. No need for javascript at all. - Make an ajax call to the server to request a random link and when that is returned, go to it.
- Make a get request to the server and have the server return a redirect to a randomly chosen URL.
It sounds like you don't want to implement the first option if you have a zillion URLs.
The second option is probably the easiest as it requires only slightly modifying the generation of the page and requires no new server APIs. You just have to figure out how to select a random URL in your server-side environment.
The third and fourth options are the least efficient as they require a call to the server, a response from the server with the new URL and then a client redirect to the actual URL.