3 ms·
Does this work if you want to allow an iframe to execute code in a parent browser window from a different domain? (Assuming you control both domains and can inj
by noduerme 5y ago
Does this work if you want to allow an iframe to execute code in a parent browser window from a different domain? (Assuming you control both domains and can inject a different Sec-fetch-mode header into the parent page)?
Context here: I'm maintaining a PWA that has to run on local iphones/android devices and maintain contact with a server on local networks in the 127.x block. But the point of download for the app itself is under an https domain on the open internet. It uses an iframe to check lots of local 127.x.x addresses until it finds one with a local server, and bootstraps itself to the code on the local server that way; unfortunately, it can't run as a true PWA because the iframe at the center of it violates CORS (due to the ban on mixing clear and SSL requests in the more recent versions of Chrome and Safari). Would be nice if the local servers could simply serve up their content and control the window without a whole domain-specific postMessage protocol.
- JimDabell 5y agoThis approach relies on the backend proxying `/api` to the API. In other words, the client requests http://www.example.com/api/foo http://www.example.com/api/foo, then the backend goes off and fetches http://api.example.com/foo http://api.example.com/foo, then sends it back to the client. You can’t do that because in your case only the client can connect to the local networks; your backend has no access.
- noduerme 5y agoAh. ok. I didn't realize this was strictly a backend call.