简体   繁体   English

如何在共享点Web部件中添加内联JS / HTML代码

[英]How to add a inline JS/HTML code in a sharepoint web part

I'm currently trying to costimize my bot that is embedded in my sharepoint web site. 我目前正试图使嵌入在我的sharepoint网站中的我的机器人最大化。 for this i need to add the code below in a web part or at least the link and the . 为此,我需要在Web部件中至少添加以下代码,或者至少在链接和中添加。

<html>
  <head>
    <link href="https://cdn.botframework.com/botframework-webchat/latest/botchat.css" rel="stylesheet" />
  </head>
  <body>
    <div id="bot"/>
    <script src="https://cdn.botframework.com/botframework-webchat/latest/botchat.js"></script>
    <script>
      BotChat.App({
        directLine: { secret: 'YOUR_DIRECT_LINE_SECRET' },
        user: { id: 'USER_ID' },
        bot: { id: 'YOUR_BOT_ID' },
        resize: 'detect'
      }, document.getElementById("bot"));
    </script>
  </body>
</html>

Can someone help me please ? 有人能帮助我吗 ?

PS: i really don't know much about sharepoint but i know that the version of sharepoint user is the last one. PS:我对共享点确实不太了解,但是我知道共享点用户的版本是最后一个。

You can Use Content Editor Web Part. 您可以使用内容编辑器Web部件。

follow below steps: 请按照以下步骤操作:

  1. Create your JS file in SharePoint designer and put your html and JS code here. 在SharePoint设计器中创建JS文件,并将html和JS代码放在此处。

  2. Open the page in browser where you want to add this code 在要添加此代码的浏览器中打开页面

  3. Click on edit page from the gear icon present at the top right corner. 从右上角的齿轮图标单击编辑页面。 在此处输入图片说明

  4. On ribbon click on Insert >> Under category select Media and content >> select content editor web part and click Add. 在功能区上,单击插入>>在类别下,选择媒体和内容>>选择内容编辑器Web部件,然后单击添加。

  5. click on the triangle present at the right corner of content editor web part and click on edit web part. 单击内容编辑器Web部件右上角的三角形,然后单击“编辑Web部件”。

  6. Add the link of your JS file and click on Test. 添加您的JS文件的链接,然后单击“测试”。 在此处输入图片说明

  7. Click Apply and OK 单击“应用”,然后单击“确定”。

  8. From the ribbon click Save and then stop editing. 从功能区中单击“保存”,然后停止编辑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM