# Banner not dismissing

**URL:** <https://meta.discourse.org/t/banner-not-dismissing/70043>\
**Category:** Bug\
**Created:** [2017 年 9 月 14 日午後 12:46 UTC](https://meta.discourse.org/t/banner-not-dismissing/70043 "2017-09-14T12:46:58Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![jordan1909](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jordan1909](https://meta.discourse.org/u/jordan1909)\
**Post date:** [2017 年 9 月 14 日午後 12:46 UTC](https://meta.discourse.org/t/banner-not-dismissing/70043/1 "2017-09-14T12:46:58Z")

</div>

Hello all  
I have implemented custom code to inject a more dynamic banner into Discourse. I essentially just  
set #banner-content to be an object with my secondary page as the body. This works quite well and  
I am getting almost all of the results I expect.

The problem I have to manually set the banner-content depending on the URL as it wasn’t propagating properly. Once doing this however on a page refresh the banner comes back regardless of if the user dismissed it or not.

My question is this: Is there a site setting I can access via Discourse.user to determine if they’ve dismissed the banner?

##### Code I am using

```
<script type="text/discourse-plugin" version="0.4">
api.onPageChange((url, title) => {
    if(url === '/'){
        $('#banner').css({'display' : 'block'});
        $('#banner-content').html('<object class="banner-container" data="https://myforumurl/banner.html">');
    }
    
    //Display the whos online plugin only for staff.
    if(Discourse.User.currentProp('staff') !== true){
        $('#whos-online').remove();
    }

    /**
    * If the banner is showing detect if we are away from the main page.
    * If we are on any page other than home set the banner to be invisible. 
    * Don't use .remove(); as that would require re adding the element after.
    */
    if($('#banner').is(':visible')){
        if(url !== '/'){
            $('#banner').css({'display': 'none'});
        }
    }
}

```

#### Update

So it appears that the dismissed\_banner\_key is not being properly updated. When I select to update this key I get a new value which appears correct but I additionally get a NOT FOUND error. I know this is in reference to the dismissal as it only appears when I select to dismiss the banner. This was working fine before the most recent update. Has something happened in the most recent rev?

```
Not Found
s@https://myforum.com/assets/ember_jquery-a8dcbd325e04410f036f2a791d66d8316c48c5387acdd914de99a5dd6afb3cd3.js:14:27536
o@https://myforum.com/assets/ember_jquery-a8dcbd325e04410f036f2a791d66d8316c48c5387acdd914de99a5dd6afb3cd3.js:14:27393
i@https://myforum.com/assets/ember_jquery-a8dcbd325e04410f036f2a791d66d8316c48c5387acdd914de99a5dd6afb3cd3.js:14:27322
trigger@https://myforum.com/assets/ember_jquery-a8dcbd325e04410f036f2a791d66d8316c48c5387acdd914de99a5dd6afb3cd3.js:19:4711
_onError/<@https://myforum.com/assets/ember_jquery-a8dcbd325e04410f036f2a791d66d8316c48c5387acdd914de99a5dd6afb3cd3.js:19:6692
invokeWithOnError@https://myforum.com/assets/ember_jquery-a8dcbd325e04410f036f2a791d66d8316c48c5387acdd914de99a5dd6afb3cd3.js:7:17919
flush@https://myforum.com/assets/ember_jquery-a8dcbd325e04410f036f2a791d66d8316c48c5387acdd914de99a5dd6afb3cd3.js:7:18364
flush@https://myforum.com/assets/ember_jquery-a8dcbd325e04410f036f2a791d66d8316c48c5387acdd914de99a5dd6afb3cd3.js:7:19124
end@https://myforum.com/assets/ember_jquery-a8dcbd325e04410f036f2a791d66d8316c48c5387acdd914de99a5dd6afb3cd3.js:7:19469
run@https://myforum.com/assets/ember_jquery-a8dcbd325e04410f036f2a791d66d8316c48c5387acdd914de99a5dd6afb3cd3.js:7:20538
u@https://myforum.com/assets/ember_jquery-a8dcbd325e04410f036f2a791d66d8316c48c5387acdd914de99a5dd6afb3cd3.js:13:1629
e/i.error@https://myforum.com/assets/application-9e0a922055fc3f9e9e6a011c36bea139b9b6d7fe31884a4038e65a13fb75b5e1.js:2:1160
l@https://myforum.com/assets/ember_jquery-a8dcbd325e04410f036f2a791d66d8316c48c5387acdd914de99a5dd6afb3cd3.js:2:6359
fireWith@https://myforum.com/assets/ember_jquery-a8dcbd325e04410f036f2a791d66d8316c48c5387acdd914de99a5dd6afb3cd3.js:2:7127
r@https://myforum.com/assets/ember_jquery-a8dcbd325e04410f036f2a791d66d8316c48c5387acdd914de99a5dd6afb3cd3.js:3:10013
n/<@https://myforum.com/assets/ember_jquery-a8dcbd325e04410f036f2a791d66d8316c48c5387acdd914de99a5dd6afb3cd3.js:3:15842

```

---

_[View the full topic](https://meta.discourse.org/t/banner-not-dismissing/70043)._
