# Feedback on "on-discourse" javascript for setting up custom JS for each page?

**URL:** https://meta.discourse.org/t/feedback-on-on-discourse-javascript-for-setting-up-custom-js-for-each-page/285647
**Category:** Development
**Created:** [November 16, 2023, 3:48am UTC](https://meta.discourse.org/t/feedback-on-on-discourse-javascript-for-setting-up-custom-js-for-each-page/285647 "2023-11-16T03:48:54Z")
**Posts on this page:** 1
**Showing post:** 12

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [November 18, 2023, 1:56pm UTC](https://meta.discourse.org/t/feedback-on-on-discourse-javascript-for-setting-up-custom-js-for-each-page/285647/12 "2023-11-18T13:56:27Z")

</div>

> [@Chris\_Dawson](#):
>
> I played around with various attempts to get notified when the page changes, but it does not seem like Ember provides the hooks, and I was unable to find any custom events that I could listen for.

This is what you need [How do you force a script to refire on every page load in Discourse? - #5 by simon](https://meta.discourse.org/t/how-do-you-force-a-script-to-refire-on-every-page-load-in-discourse/74856/5)

```plaintext
<script type="text/discourse-plugin" version="0.8">
    api.onPageChange(() =>{
        // code
    });
</script>
```

---

_[View the full topic](https://meta.discourse.org/t/feedback-on-on-discourse-javascript-for-setting-up-custom-js-for-each-page/285647)._
