# How to create a dynamic header link?

**URL:** https://meta.discourse.org/t/how-to-create-a-dynamic-header-link/266019
**Category:** Development
**Tags:** custom-header-links
**Created:** [May 23, 2023, 8:44am UTC](https://meta.discourse.org/t/how-to-create-a-dynamic-header-link/266019 "2023-05-23T08:44:07Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![chien.wu](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@chien.wu](https://meta.discourse.org/u/chien.wu)
#### Post date: [May 23, 2023, 8:44am UTC](https://meta.discourse.org/t/how-to-create-a-dynamic-header-link/266019/1 "2023-05-23T08:44:07Z")

</div>

My question is specifically about [Custom Header Links (icons)](https://meta.discourse.org/t/custom-header-links-icons/86307).

What should I do if the URL is not fixed, is there a way to link to javascript to perform actions?

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [May 23, 2023, 8:45am UTC](https://meta.discourse.org/t/how-to-create-a-dynamic-header-link/266019/2 "2023-05-23T08:45:20Z")

</div>

Hey chien!

It would require a custom script, yes. Can you explain your use case?

---

<div class="post-metadata">

### Author: ![chien.wu](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@chien.wu](https://meta.discourse.org/u/chien.wu)
#### Post date: [May 24, 2023, 12:10am UTC](https://meta.discourse.org/t/how-to-create-a-dynamic-header-link/266019/3 "2023-05-24T00:10:01Z")

</div>

Thanks for the reply,  
I need to call the chat plugin to create a specific chat room,  
probably like this:

```js
  @action
  chatWithSomebody() {
    chat
    .upsertDmChannelForUsernames([somebody_name])
    .then((channel) => {
      this.router.transitionTo("chat.channel", ...channel.routeModels);
    });
  }

```
