0

While using the MS chat bot - directline channel in SharePoint pages, i'm getting a error :

Error message:

webchat-es5.js:1 Refused to connect to 'wss://directline.botframework.com/v3/directline/conversations/DdAvR7sMQ8zAXx0oltBdoC-h/stream?' because it violates the following Content Security Policy directive: "default-src https: data: 'unsafe-inline' 'unsafe-eval'". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback.

I tried to add the directline webchat in a mormal HTML page,its working as expected. so something is stopping it to run inside sharepoint

      <script>
     window.WebChat.renderWebChat(
        {
           directLine: window.WebChat.createDirectLine({
              token: 'my token here'
           }),
           userID: 'my name'

        },
        document.getElementById('webchat')
     );
  </script>

I want my code should run inside the SharePoint page

About my SharePoint page: Environment: SP 206 on-premise code added inside a CE webpart i used the local reference as well as CDN reference of webchat.js / webchar-e5.js / botchat.js.

Angel F Syrus
  • 1,984
  • 8
  • 23
  • 43
Jegan Baskaran
  • 337
  • 2
  • 16
  • can anyone help me with this issue ? – Jegan Baskaran Sep 19 '19 at 05:53
  • Are you using a Content Editor (you said CE) web part or a Script Editor web part? You should be using a script editor web part. You can also use modern pages and use Embed web part. Also; are you open to using SPFx? – Dana V Sep 20 '19 at 01:22
  • Thanks for replying Dana V, i tried in both content editor and script editor , in both i got the same error message in console,i don't have options to use modern pages or SPFx, please suggest me a different solution – Jegan Baskaran Sep 24 '19 at 11:19
  • I'm not exactly sure, but it looks to be something with Content Security Policy. See more general issue [here](https://stackoverflow.com/questions/34852682/refused-to-load-the-script-because-it-violates-the-following-content-security-po) and more info: https://content-security-policy.com/ – Dana V Oct 01 '19 at 23:46

0 Answers0