1.21 gigawatts
1.21 gigawatts

Reputation: 17830

Iframe error when loading from localhost net::ERR_BLOCKED_BY_CLIENT

I have a web page that has a website that is loaded in an iframe like so.

<iframe id="example" src="https://www.example.com"></iframe>

It has an API that you can use to communicate with it through post messages.

If I post a message to it with a URL to a resource it will process that resource. It works on a remote domain. But I'm testing locally. When I use http://localhost/resource.txt I get an error in the console from the embedded website:

net::ERR_BLOCKED_BY_CLIENT

I'm guessing this may be a CORs issue. Is it possible to set the iframe so that it can load the resource locally?

Upvotes: 0

Views: 46

Answers (1)

David Bradshaw
David Bradshaw

Reputation: 13087

You just need to use the external IP address of your local machine, rather than localhost.

Upvotes: 0

Related Questions