Using I-frame to load external webpage
-
This I-frame code works and loads the external page on our cloud server running outside our network. However when we run the same code on a box on our local network I get this error... Requests to the server have been blocked by an extension.
<iframe id="Weather_I-Frame" ng-init="WeatherPageShow=true" ng-show="WeatherPageShow" src="https://www.wunderground.com/weather-forecast/Nova_Scotia/Halifax.html?hdf=1" style="position: absolute; left: 0px; top: 0px; height: 100%; width: 100%;"></iframe>
How do I look for the issue stopping this from loading? I have stopped all chrome extensions with no effect.
I can also ping www.wunderground.com from the local system console. -
@Phillip-Weeks please read, it really makes it easier to help you
https://help.infiniteautomation.com/reporting-bugs/I suspect that it's due to CSP, this would be confirmed by your browser console messages.
This thread will tell you more about CSP and configuring it.
https://forum.infiniteautomation.com/topic/3577/query-an-external-web-service-from-a-mango-page -
Thanks Jared I read through the docs, it mentioned disabling the content security policy, I found the answer in the original post. Thanks
-
Jared in order to get the iframe to load the external web page I added the frame-src and domain...
web.security.contentSecurityPolicy=default-src 'self'; frame-src 'self' https://www.wunderground.com; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; connect-src ws: wss: 'self'; img-src 'self' data:
-
Thanks for sharing the resolution!
-
@Phillip-Weeks just a heads up to read the release notes when upgrading to Mango 3.4.5, the CSP configuration has changed in the env.properties file.