Forums

How to use iframe on pythonanywhere where content is hosted by pythonanywhere.

I'm trying to insert some iframes into http://elksie5000.pythonanywhere.com/portfolio

As a test I've used this as my src=" https://www.pythonanywhere.com/user/elksie5000/files/home/elksie5000/erect_penis_dashboard.html"

Why do I get refusal to connect as it is part of your network?

You need to set the frame options on the site that you're trying to load in the iframe: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options

So how to I write that into HTML of the page where I want to host which is on pythonanywhere?

<httpProtocol> <customHeaders> <add name="X-Frame-Options" value="sameorigin"/> </customHeaders> </httpProtocol>

You don't. The site that you're trying to frame needs to set the header.