任何浏览器都不支持iframe

时间:2020-06-02 09:32:12

标签: javascript html reactjs iframe django-rest-framework

我在控制台标签中得到此错误

X-Frame-Options拒绝的负载:“ DENY”来自 “ http://localhost:8000/media/song/bensound-betterdays.mp3”,网站 不允许任何框架。尝试加载到 “ http://localhost:3000/home”。

我也遵循此link来解决此问题,但没有帮助。

api数据:

JSON


settings.py

[
    {
        "id": 1,
        "song": "http://localhost:8000/media/song/bensound-betterdays.mp3",

    },
]


./src/Home.js

CORS_ALLOW_HEADERS = [
    'accept',
    'accept-encoding',
    'authorization',
    'content-type',
    'dnt',
    'origin',
    'user-agent',
    'x-csrftoken',
    'x-requested-with',
]

![enter image description here

1 个答案:

答案 0 :(得分:0)

settings.py 更改为:

X_FRAME_OPTIONS = 'http://localhost:8000'