cfiles
cfiles copied to clipboard
Absolute url / Relative url
In our site we often use Iframes (custom pages) to display the content of some files (example: tutorial.pdf files )
Files and custom pages are of course stored in the same site.
They are displayed correctly in FFox and Edge, but since a few days they are not displayed correctly in Chrome.
Instead we get an error in the console:
Refused to display '[https:/sitedomain.xy/](https://https/)' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
We dont understand the reason because everything is in the same site.
After some investigation we noticed the following:
- In Iframe we used the absolute url ( easy and lazzy copy of the url that we get from the "Display Url" popup) .
https://sitedomain.xy/HH/index.php?r=file%2Ffile%2Fdownload&guid=db4b25e2-57d6-4b69-b811-0a4f9b19a68b
- should we use instead the relative url
/HH/index.php?r=file%2Ffile%2Fdownload&guid=db4b25e2-57d6-4b69-b811-0a4f9b19a68b
Hmm, thats strange. An option could be to allow the X-Frame-Options
.
https://docs.humhub.org/docs/admin/security#web-security-configuration
Thanks Luke, No succes with your advice But it still works in FFox and Edge In Chrome it works only if we use relative url. And in Chrome/Android it doesn't work at all, but this is another story.
So, I built a "PDF Iframe" custom page template with a few lines of javascript that converts the native absolute url into a relative url.