0

Let's say I have a list such as

var websites = {
    website1.com,
    website2.com,
    website3.com,
};

When I press something, such as a <a> tag, choose from the list of websites, and automatically go there. I don't want any customization, repeating pages are fine, I just want something basic and simple.

1 Answers1

0

You just need to make it a complete URL and set window.location equal to that URL.

Also, for a simple list, an array like [1, 2, 3] can be easier to work with than an object like {1,2,3}. Try this:

var websites = [
"website1.com",
"website2.com",
"website3.com"
];

var exitURL = "http://" + websites[i];

window.location = exitURL;
jonaz
  • 2,096
  • 1
  • 17
  • 30