# Communities with embedded Twitter Feeds

**URL:** https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962
**Category:** Support
**Created:** [November 20, 2019, 9:10pm UTC](https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962 "2019-11-20T21:10:04Z")
**Posts on this page:** 14
**Page:** 2

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [December 15, 2019, 5:04pm UTC](https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962/24 "2019-12-15T17:04:21Z")

</div>

> [@aliyosefzai](#):
>
> Unchecking this option has any security risks ?

Yes, unchecking that setting is not recommended. CSP - content security policy - is on by default for very good reasons. If you need to whitelist some scripts that would normally be flagged by CSP, you can add them to the `content_security_policy_script_src` setting on your site and they would then work without issue. You can read

> [@Mitigate XSS Attacks with Content Security Policy](https://meta.discourse.org/t/mitigate-xss-attacks-with-content-security-policy/104243):
>
> bookmark This guide explains how to use Content Security Policy (CSP) to mitigate Cross-Site Scripting (XSS) attacks in Discourse. It covers CSP basics, configuration, and best practices. person_raising_hand Required user level: Administrator Summary Content Security Policy (CSP) is a crucial security feature in Discourse that helps protect against Cross-Site Scripting (XSS) and other injection attacks. This guide covers the basics of CSP, how it’s implemented in Discourse, and how to c…

if you want to learn more about this.

---

<div class="post-metadata">

### Author: ![smrtey](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@smrtey](https://meta.discourse.org/u/smrtey)
#### Post date: [December 15, 2019, 7:57pm UTC](https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962/25 "2019-12-15T19:57:54Z")

</div>

> [@Johani](#):
>
> unchecking that setting is not recommended.

Doesn’t that setting come unchecked by default?

---

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [December 15, 2019, 8:06pm UTC](https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962/26 "2019-12-15T20:06:26Z")

</div>

No, that setting has been on by default for a while now.

[https://github.com/discourse/discourse/pull/6873](https://github.com/discourse/discourse/pull/6873)

---

<div class="post-metadata">

### Author: ![smrtey](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@smrtey](https://meta.discourse.org/u/smrtey)
#### Post date: [December 15, 2019, 8:59pm UTC](https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962/27 "2019-12-15T20:59:41Z")

</div>

Weird, our site didn’t even exist in Jan but our default is not checked

---

<div class="post-metadata">

### Author: ![aliyosefzai](https://avatars.discourse-cdn.com/v4/letter/a/dc4da7/32.png) [@aliyosefzai](https://meta.discourse.org/u/aliyosefzai)
#### Post date: [December 16, 2019, 4:34pm UTC](https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962/29 "2019-12-16T16:34:40Z")

</div>

Thanks Joe,  
I white listed scripts for twitter time line, It works now with CSP option checked.

---

<div class="post-metadata">

### Author: ![aliyosefzai](https://avatars.discourse-cdn.com/v4/letter/a/dc4da7/32.png) [@aliyosefzai](https://meta.discourse.org/u/aliyosefzai)
#### Post date: [December 19, 2019, 3:47pm UTC](https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962/30 "2019-12-19T15:47:40Z")

</div>

Is it possible to change background color of twitter time line to match with the forum background ?

---

<div class="post-metadata">

### Author: ![smrtey](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@smrtey](https://meta.discourse.org/u/smrtey)
#### Post date: [December 21, 2019, 6:42pm UTC](https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962/31 "2019-12-21T18:42:03Z")

</div>

> [@aliyosefzai](#):
>
> change background color of twitter time line

Not easily because it’s in an iFrame so you can’t just add CSS but there are various suggestions on stackexchange, but not sure which work, for example

[https://stackoverflow.com/questions/40674291/styling-a-twitter-feed-css-wont-target-timeline-tweet-text](https://stackoverflow.com/questions/40674291/styling-a-twitter-feed-css-wont-target-timeline-tweet-text).

Because of lazy loading (sorry if this isn’t the correct term) on discourse, I think any js solution will require

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

```

---

<div class="post-metadata">

### Author: ![aliyosefzai](https://avatars.discourse-cdn.com/v4/letter/a/dc4da7/32.png) [@aliyosefzai](https://meta.discourse.org/u/aliyosefzai)
#### Post date: [March 27, 2020, 4:10pm UTC](https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962/32 "2020-03-27T16:10:33Z")

</div>

Hi,

After installing twiiter sidebar to production we are having issues with Dashboard cannot load “Signups” or any individual report it just keeps loading never loads. Discourse version is 2.4.1 recently upgraded. When I remove Twitter side bar component it works fine. Any ideas why this would happen ?

Thanks

---

<div class="post-metadata">

### Author: ![smrtey](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@smrtey](https://meta.discourse.org/u/smrtey)
#### Post date: [March 27, 2020, 5:21pm UTC](https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962/33 "2020-03-27T17:21:43Z")

</div>

Do you have content security policy enabled? I have it working with these settings

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

I’m running 2.5.0.beta2. No idea what it could have to do with reports but I can generate all the reports on my sites

---

<div class="post-metadata">

### Author: ![aliyosefzai](https://avatars.discourse-cdn.com/v4/letter/a/dc4da7/32.png) [@aliyosefzai](https://meta.discourse.org/u/aliyosefzai)
#### Post date: [March 27, 2020, 6:25pm UTC](https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962/34 "2020-03-27T18:25:25Z")

</div>

I have the same settings as you for security policy. When I remove Twitter Sidebar reports start working for some reason.

---

<div class="post-metadata">

### Author: ![smrtey](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@smrtey](https://meta.discourse.org/u/smrtey)
#### Post date: [March 27, 2020, 6:50pm UTC](https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962/35 "2020-03-27T18:50:38Z")

</div>

Sorry, I really have no idea how to go about troubleshooting something involving a conflict with site reports

---

<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: [March 30, 2020, 7:09pm 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"; 
        }
    }
});

```

---

<div class="post-metadata">

### Author: ![Ali3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ali3/32/161350_2.png) [@Ali3](https://meta.discourse.org/u/Ali3)
#### Post date: [June 8, 2020, 8:26pm UTC](https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962/37 "2020-06-08T20:26:58Z")

</div>

Is there any one, who can help me to embedd Twitter feed, like they have on the sidebar?

---

<div class="post-metadata">

### Author: ![edgarriba](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/edgarriba/32/204929_2.png) [@edgarriba](https://meta.discourse.org/u/edgarriba)
#### Post date: [February 10, 2021, 11:22pm UTC](https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962/38 "2021-02-10T23:22:43Z")

</div>

> [@tobiaseigen](#):
>
> It is a challenge to encourage them to have deeper, longer term conversations on the forum about things they tweet about

I fully support this idea. Has anyone tried with success to get rid of twitter addiction from their community ?

[Previous page](https://meta.discourse.org/t/communities-with-embedded-twitter-feeds/133962.md?page=1)
