VA3HDL / hamdashboard

Customizable Dashboard for Ham Radio
https://youtu.be/sIdqMQTGNSc
MIT License
117 stars 71 forks source link

Connection refused when attempting to load an image #9

Closed midair55 closed 4 months ago

midair55 commented 4 months ago

First - This is a great enhancement of Dave's (N2MXX) dashboard!!! Kudos! Steve - N5NG

The following image for the ARRL Band Plan was defined for one of the slide out menus using:

[ "2196F3", "Band Plan", "https://www.arrl.org/images/view/Charts/Band_Chart_Image_for_ARRL_Web.jpg", "1", "R", ],

Selecting the slide out button results in the message, "www.arrl.org refused to connect." being displayed.

gregbartels commented 4 months ago

Hi!

This happens because ARRL refuse the connection (I just test in my lab) I will suggest you use another source for the picture, for example, I use this https://kd4atw.org/wp-content/uploads/2012/05/band_plan.png as a test and works great or https://qsl.net/n2vzd/images/ARRLminibandplancard.jpg which is a little bit bigger but good for vision!

73 de TI3GB

midair55 commented 4 months ago

Greg:

Thank you for the suggested alternate images for the band plan!

Interestingly, the ARRL image opens correctly when the URL is entered in a new tab on the browser. This suggests something subtle in the dashboard that is causing the refused connection.

midair55 commented 4 months ago

The 'refused connection" is also seen when attempting to launch "https://aviationweather.gov/data/metar/?id=KTTS,KTIX,KXMR,KCOF,KMLB&hours=0&decoded=yes" from a slide out window. The URL opens correctly in a new browser tab.

[ "2196F3", "Wx Obs", "https://aviationweather.gov/data/metar/?id=KTTS,KTIX,KXMR,KCOF,KMLB&hours=0&decoded=yes", "1" ],

VA3HDL commented 4 months ago

Hey guys,

Greg is correct.

This is caused by the so called "same-origin policy":

In computing, the same-origin policy (SOP) is a concept in the web application security model. Under the policy, a web browser permits scripts contained in a first web page to access data in a second web page, but only if both web pages have the same origin.

Because the dashboard is local and web page or image are remote (and NOT same-origin) the browser respects the decision from the origin web server directive and do not show the content.

Unfortunately workarounds to this involve installing another piece of middle-ware (a proxy server) is impractical for this simple dashboard application and will increase the usage complexity.

This is even happening if you have a Pi-Star digital hotspot and you want to embed into the dashboard. But because you are in control of the web server on the pi-start is it easy to fix. I posted the solution on the readme.

You have to find alternates for others, because you cannot control the ARRL web server or the AviationWeather web server.

I hope this clear this type of errors.

73, Pablo, VA3HDL

midair55 commented 4 months ago

Thank you Pablo!