问题
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