# Forcing Redirect in p5

**URL:** https://discourse.processing.org/t/forcing-redirect-in-p5/4154
**Category:** Coding Questions
**Created:** [October 5, 2018, 3:33am UTC](https://discourse.processing.org/t/forcing-redirect-in-p5/4154 "2018-10-05T03:33:38Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![dorf](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@dorf](https://discourse.processing.org/u/dorf)
#### Post date: [October 5, 2018, 3:33am UTC](https://discourse.processing.org/t/forcing-redirect-in-p5/4154/1 "2018-10-05T03:33:38Z")

</div>

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:

```auto
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 = ("'https://emmetkells.com'")
var el4 = ('" >')

```

---

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [October 5, 2018, 5:07am UTC](https://discourse.processing.org/t/forcing-redirect-in-p5/4154/2 "2018-10-05T05:07:48Z")

</div>

- [Forum.Processing.org/two/discussion/8809/link-function](http://Forum.Processing.org/two/discussion/8809/link-function)
