# Communities with embedded Twitter Feeds

**URL:** <https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962>\
**Category:** Product Support\
**Created:** [20 november 2019 om 21:10 UTC](https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962 "2019-11-20T21:10:04Z")\
**Posts on this page:** 1\
**Showing post:** 36

<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:** [30 maart 2020 om 19:09 UTC](https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962/36 "2020-03-30T19:09:24Z")

</div>

The error is **TypeError: document.getElementById(…) is null**

 ![image](https://global.discourse-cdn.com/meta/original/3X/2/4/24ece01896ce6f4c26a660ab7b5a50de5a56f7eb.png)

Apparently the `#sidebar` div is not inserted on every page?

It can be fixed by properly checking if the element is not `null`.

```
api.onPageChange(() => {
    if (Discourse.User.current() !== null){ 
        var sb = document.getElementById("sidebar")
        if (sb) { 
            sb.style.display = "block"; 
        }
    } 
});
api.onPageChange(() => { 
    var is_iPad = navigator.userAgent.match(/iPad/i) != null;
    if(is_iPad) {
        var sb = document.getElementById("sidebar")
        if (sb) { 
            sb.style.display = "none"; 
        }
    }
});

```

---

_[View the full topic](https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962)._
