I made a page with iframe . Inside the iframe I want to show several different links, such as an article from facebook, or news, or a video on YouTube, or any other possible URL. But because of the Xframe header, I cannot do this. I referenced the following link: https://docs.djangoproject.com/en/1.8/ref/clickjacking/ as well as Django XFrameOptionsMiddleware (X-Frame-Options) - allow iframe by client IP
but did not receive any help.
My settings.py MIDDLEWARE_CLASSES file:
MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', )
From http://django-secure.readthedocs.org/en/latest/middleware.html I found that using the @frame_deny_exempt decorator my problem can be solved. However, I get the same error in the chrome console, i.e. Refused to display '<URL>' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN, SAMEORIGIN'.
Any help with this?
python django iframe x-frame-options clickjacking
amulya349
source share