Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var links = [
function openSite() {
// get a random number between 0 and the number of links
var randIdx = Math.random() * links.length;
// round it, so it can be used as array index
randIdx = parseInt(randIdx, 10);
// construct the link to be opened
var link = '' + links[randIdx];
// Open the link
Copy link

Hi @rileyrichter, what if there are more than 100 cms items, and new items will be added daily? Are there better ways to handle the links rather than copy-and-paste them 1 by 1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment