网页,嵌入网易云音乐,直接复制网易云音乐给的代码,显示跨域,不知道应该如何解决?

2018-04-18 18:38:53 +08:00
 sevenQu
<iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width="330" height="450" src="//&lt;a href=" http:="" <a="" href="http://music.163.com" rel="nofollow">music.163.com="" outchain="" player?type="0&id=953939511&auto=1&height=430"" rel="nofollow">music.163.com/outchain/player?type=0&id=953939511&auto=1&height=430"></iframe>

iframe 或者 flask 插件版我都试了,都会显示跨域

那不就等于网易云这个不就是没用的?我看到其他网页,还是有可以使用成功的,不知道怎么做?希望有人可以指点一下,谢谢

5519 次点击
所在节点    HTML
5 条回复
swuzjb
2018-04-18 18:56:11 +08:00
因为你搞了 https ?
xiaopc
2018-04-18 19:15:49 +08:00
配置你 Web Server 的 X-Frame-Options 头
sevenQu
2018-04-18 22:40:06 +08:00
@swuzjb 我什么都没做,就是一个 html 原始的网页很简单的那种
sevenQu
2018-04-18 22:41:44 +08:00
@xiaopc 这个涉及到后端配合了吧,网易云音乐给的本来的标签里已经进行请求了,不知道有没有什么简单的做法?
yaooo
2021-12-28 14:17:12 +08:00
<iframe frameborder="no"
border="0"
marginwidth="0"
marginheight="0"
width=510
height=86
scrolling="no"
src="https://music.163.com/outchain/player?type=2&id=1413863166&auto=0&height=66"
align=center></iframe>
我的这个可以用,你试试

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/447912

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX