Django page not rendering in Facebook iframe

2019-07-15 17:54发布

问题:

i'm trying to show this django page (https://www.mm.viance.com.ec/cupones/) in a Facebook iframe and I'm getting a blank page.

I tried getting an SSL certificate, and it didn't work. I also tried bypassing de csrf_token protection.

The page renders just fine in a browser, but not inside the Facebook iframe.

Any help will be appreciated.

Thanks in advance,

回答1:

Django uses Clickjacking protection with 'django.middleware.clickjacking.XFrameOptionsMiddleware'.

To allow the site to be embedded in an iframe just erase that middleware from settings.py

https://docs.djangoproject.com/en/dev/ref/clickjacking/#clickjacking-prevention