# Event webNavigation.onCompleted not firing

**URL:** https://discourse.mozilla.org/t/event-webnavigation-oncompleted-not-firing/95823
**Category:** Development
**Tags:** issue
**Created:** [April 11, 2022, 5:28pm UTC](https://discourse.mozilla.org/t/event-webnavigation-oncompleted-not-firing/95823 "2022-04-11T17:28:18Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![elnath78](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/elnath78/32/23893_2.png) [@elnath78](https://discourse.mozilla.org/u/elnath78)
#### Post date: [April 11, 2022, 5:28pm UTC](https://discourse.mozilla.org/t/event-webnavigation-oncompleted-not-firing/95823/1 "2022-04-11T17:28:19Z")

</div>

Following this example, I’m unable to trigger this listener, added it on my content script:

```auto
const filter = {
  url:
  [
    {hostContains: "example.com"},
    {hostPrefix: "developer"}
  ]
}

function logOnCompleted(details) {
  console.log(`onCompleted: ${details.url}`);
}

browser.webNavigation.onCompleted.addListener(logOnCompleted, filter);

```

I also tried moving it to background script but still, the event is never triggered.

---

<div class="post-metadata">

### Author: ![freaktechnik](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/freaktechnik/32/37766_2.png) [@freaktechnik](https://discourse.mozilla.org/u/freaktechnik)
#### Post date: [April 11, 2022, 6:28pm UTC](https://discourse.mozilla.org/t/event-webnavigation-oncompleted-not-firing/95823/2 "2022-04-11T18:28:31Z")

</div>

Content scripts barely have any APIs: [https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content\_scripts#webextension\_apis](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts#webextension_apis)

Also, where are you checking when you tried it in the background script and do you have the necessary permissions?

---

<div class="post-metadata">

### Author: ![elnath78](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/elnath78/32/23893_2.png) [@elnath78](https://discourse.mozilla.org/u/elnath78)
#### Post date: [April 11, 2022, 6:37pm UTC](https://discourse.mozilla.org/t/event-webnavigation-oncompleted-not-firing/95823/3 "2022-04-11T18:37:21Z")

</div>

> [@freaktechnik](#):
>
> when you tried it in the background script and do you have the necessary permissions?

sure I do, I actually implemented this workaround:

> <https://stackoverflow.com/questions/3522090/event-when-window-location-href-changes>

---

<div class="post-metadata">

### Author: ![freaktechnik](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/freaktechnik/32/37766_2.png) [@freaktechnik](https://discourse.mozilla.org/u/freaktechnik)
#### Post date: [April 11, 2022, 6:38pm UTC](https://discourse.mozilla.org/t/event-webnavigation-oncompleted-not-firing/95823/4 "2022-04-11T18:38:52Z")

</div>

Which workaround? If it’s the popstate listener then that’s not a workaround, that’s expected behavior afaik, since the page doesn’t actually load.

---

<div class="post-metadata">

### Author: ![elnath78](https://sea1.discourse-cdn.com/flex001/user_avatar/discourse.mozilla.org/elnath78/32/23893_2.png) [@elnath78](https://discourse.mozilla.org/u/elnath78)
#### Post date: [April 11, 2022, 6:43pm UTC](https://discourse.mozilla.org/t/event-webnavigation-oncompleted-not-firing/95823/5 "2022-04-11T18:43:27Z")

</div>

> [@freaktechnik](#):
>
> Which workaround?

I mean a way to get updated on current url change, since I were unable to make the background script work.
