Links in the preview are broken.
See original GitHub issueFirst of all, thanks to everyone for the work on version 4, it turned out great.
Issue Summary
When I click on a link within the preview, I get an error message. To get rid of the error message, I have to reload the page. I did not expect to be able to navigate through the page, but there should not be an error message.
Steps to Reproduce
- Install bakerydemo
- Start server (
./manage.py runserver
) and login as admin - Open the preview
- Click a link
- I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: no
Technical details
- Python version: Python 3.10.6
- Django version: 4.0.7
- Wagtail version: 4.0
- Browser version:
- Firefox 104.0.1 (64-bit)
- Chrome 105.0.5195.52 (Official Build) (64-bit)
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Fix Facebook broken link preview - ClickWP
Fix Facebook broken link preview · 1. Visit the Facebook debugger tool – https://developers.facebook.com/tools/debug/ · 2. Paste in the problem link and click...
Read more >Facebook link preview not working? Little tips to fix it.
1. Go to the Facebook Debugger Tool; · 2. Copy and paste the URL you're having troubles with into the tool and click...
Read more >How to Fix Your Link Previews on LinkedIn (Post Inspector Tips)
It will only refresh the preview for that particular shared link. Sticking to the Post Inspector, it's your best option and takes three...
Read more >Broken links: "This is not the page you were looking for..."
... or what has changed, but now all of my links are broken on my website. If I go into Preview Mode and...
Read more >Twitter link previews broken on iMessage again - 9to5Mac
Twitter link previews are broken in iMessage for the second time this year. The issue prevents iPhones from previewing tweets when shared.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey, thanks for the report!
I’m not sure if this is something we should handle on Wagtail’s side, but the error is because the real page (not-preview) has the
X-Frame-Options
header set toDENY
.There are some workarounds to this:
<base>
element within the<head>
element, before any<link>
elements: This will make all links in the preview panel open in a new tab. You can also use_parent
if you prefer the link to be opened in the same tab.X-Frame-Options
toSAMEORIGIN
. This does not handle external links, so the issue will still show up if the external site doesn’t allow iframes.I think it’s also possible for Wagtail to modify all links in the iframe to use
target="_blank"
or disable all links within the iframe, but I don’t think it’s a good thing to do…Thanks @laymonage for pointing out the
x-frame-options
header.The
DENY
setting is on in quite popular boilerplate projects for both Nginx and Apache.