Forcing Redirect in p5

Hey everybody! This is my first post here and in any real coding forum so I apologize if I come off very amateur (it’s because I am). I am having an issue where for a project I would like to hit the enter key and be immediately redirected to a new site. I tried to use functions that would change the HTML code and force a redirect, but it’s not working and I’m pretty sure it’s because of me misunderstanding some basics in how HTML works. I am wondering if with this code I am on the right track or if there is a better way. Thanks in advance for any help you guys provide me!
this is what I got:

if ((keyCode === 13) && (index == 0)) {
  //   createElement('head', el1 + el2 + el3 + el4);
    var rr = select('head')
    rr.html(el1 +el2 + el3 + el4, true);

//those variables being
var el1 = ('<meta http-equiv="refresh"')
var el2 = (' content="1; URL=')
var el3 = ("''")
var el4 = ('" >')