Hey everyone!
I am making a newspaper website.
On the home page you see a list of all the newspapers. Each newspaper is created in the admin panel and is made up of a title, image, description, and content, which is a pdf. When you click on the link for a newspaper, it takes you a page where you can read the newspaper. the newspaper is in the form of a PDF, so I need to embed it into the site. But when I try to do so, Firefox says it cant "display the page if another site has embedded it"
What do I need to do in order to be able to embed a PDF into the site, or if there are other ways for me to display the pdf, bearing in mind that this project will end up going to production?
Thanks!
#Need help displaying a PDF that is uploaded in the admin panel
9 messages · Page 1 of 1 (latest)
Some people don't feel included by the term "guys". Please respect that and try to use alternatives such as "folks", "friends" or "djangonauts" (source: https://heyguys.cc/)
Here is a picture of the home page: https://imgur.com/a/VCz9QhC
after you click the "Test" link, it takes you to this page, which is supposed to display the pdf, but its not working https://imgur.com/a/VBzRISh
here is the github repo, thanks! https://github.com/Zain-Jaafar/School-News-Site/tree/master
GitHub
School News Site. Contribute to Zain-Jaafar/School-News-Site development by creating an account on GitHub.
The answer is probably to set x-frame-options to sameorigin, see https://docs.djangoproject.com/en/5.0/ref/clickjacking/
Of course this only applies if you're serving uploads using Django; this is often the case in development but almost never in production, so maybe revisit this once you've deployed the app, or only add the setting when working locally (e.g. if DEBUG:)
will take a look soon, thanks
Thank you so much, this worked for me.