Is It Possible to Use Iframe with Localhost Address in Source?
My Html Markup Is Pretty Simple. .. .. .. but This Page Is Blocked by All Browser That I've Used. I'm Wondering Is There Any Workaround for This Issue? Surely...
My HTML markup is pretty simple
....
<iframe width="800" height="800" src=""/>
...
but this page is blocked by all browser that I've used. I'm wondering is there any workaround for this issue? Surely, I completely understand that in case when my page will be deployed in production there will be no problems. However, how can I do any testing if iframe is blocked on local?
Thank you in advanced
5 Answers
Don't use absolute url
use relative
....
<iframe width="800" height="800" src="Handler.ashx"/>
...
When Chrome shows the following text in the iframe:
It's because the server responded with the X-Frame-Options header to DENY.
The solution is to change the server configuration so that it removes this header or sets it to SAMEORIGIN.
For example, if you're using a Django, you can either change the X_FRAME_OPTIONS setting or decorate your view with @xframe_options_sameorigin or @xframe_options_exempt.
Try using your machine's actual IP address (typically 127.0.0.1)...
<iframe width="800" height="800" src=""/>
Don't forget the port number!
P.S: On Mac OS you can run something like ifconfig | grep inet or ifconfig | grep 127 to identify your network IP address.
Simply try with relative path
<iframe width="800" height="800" src="Handler.ashx"/>
You have a few problems here. The first is that the request is expecting to be served on port 69345 (which looks very much like a port auto-configured by the debugger). Is that port currently serving requests? Can you go to that page without the iframe? When the page is deployed in production, this url is absolutely guaranteed to break because localhost always resolves to 127.0.0.1 which is relative to the client, not the server. You need to review what the actual address is or will need to be. As some posters have answered while I type this, your problem may be as simple as using a relative url. If that does not address your issue, you will need to investigate the actual ports and server names that will be serving this handler.