Embed slack on a html page

陌路散爱 提交于 2019-12-10 13:58:53

问题


I am having trouble embedding a slack feed onto a html site. When I try to use an iframe, it just shows up as a white box. I have tried using jquery

<!DOCTYPE html>
<html>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"> .       
    </script>
    <script>
$("#testLoad").load("http://www.SlackURLHere");
    </script>
  </head>
  <body>

    <div id="testLoad"></div>

    <iframe src="http://www.SlackURLHere"></iframe>
  </body>
</html>

I have tried with "http" and "https" on both iframe and jquery with no luck. :( So if you have any other methods please do share!

Thanks


回答1:


Just tried this and it looks like the reason it won't display is because of the X-Frame-Options header which is set by slack.com to be SAMEORIGIN. In other words, you're only allowed to embed that page when on slack.com, not anywhere else.




回答2:


You forgot to close the quotes on your iframe source. Otherwise it will work Also you are closing the div too early. Close it after the iframe and not before. See this fiddle



来源:https://stackoverflow.com/questions/32041731/embed-slack-on-a-html-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!