Can i use iframe with localhost address in source?

My HTML markup is pretty simple

.... <iframe width="800" height="800" src="http://localhost:69345/Handler.ashx"/> ... 

but this page is blocked by the entire browser that I used. I am wondering if there are any ways to solve this problem? Of course, I fully understand that in the case when my page is deployed in production, there will be no problems. However , how can I do any testing if the iframe is locked locally?

Thanks in advanced

+6
source share
5 answers

Do not use an absolute URL

use relative

 .... <iframe width="800" height="800" src="Handler.ashx"/> ... 
+4
source

Try using the actual IP address of your device (usually 127.0.0.1) ...

 <iframe width="800" height="800" src="http://127.0.0.1:69345/Handler.ashx"/> 

Do not forget the port number!

PS: On Mac OS, you can run something like ifconfig | grep inet ifconfig | grep inet or ifconfig | grep 127 ifconfig | grep 127 to determine your IP address on the network.

+2
source

Just try with a relative path

 <iframe width="800" height="800" src="Handler.ashx"/> 
0
source

You have a few problems here. Firstly, it is expected that the request will be sent to port 69345 (which is very similar to the port configured using the debugger). Is this port currently serving requests? Can you go to this page without an iframe? When a page is deployed in production, this URL is absolutely guaranteed to break, because localhost always permits 127.0.0.1, which is relative to the client, not the server. You need to reconsider what the actual address is or should be. Since some posters answered when I print this, your problem may be as simple as using a relative url. If this does not concern your problem, you will need to examine the actual names of the ports and servers that this handler will serve.

0
source

The relative path will not work because it uses a different port.

-1
source

Source: https://habr.com/ru/post/926503/


All Articles