You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I installed ebusd, and I can get all messages with the ebusdctl command.
I also enabled the http interface, and it delivers raw json output to a browser.
So far so good. But when I try to use this json output to make a simple html page to show selected messages in elements like div (using javascript), this doesn’t seem to be so easy.
I can manually save de json data to a local file, and when I read this file into my page (using fetch api), it works just fine, I can display most messages In a div or other element.
But when I try to fetch the json directly from the url produced by the daemon (localhost:8889/data) , I run into the “same origin policy”: the requests are refused, even when they come from the same localhost where the daemon is running. The problem seems to be that the daemon delivers http on port 8889, and the html page uses port 80: not the same port, so “same origin policy” error.
I already tried several things:
Tried to set the http port of the daemon also to 80: then it doesn’t work anymore, probably because Apache is already listening to port 80.
Tried to read the data locally from the html path (/var/ebusd/html). But that folder doesn’t seem to exist. There is a /etc/ebusd/html folder, however it only contains some cfg files and never shows any html or json. Also changing the location where ebusd delivers html files doesn’t show any html or json in that folder.
Any ideas on how to show selected messages from the json output (or from TCP) in a simple html page using javascript?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I installed ebusd, and I can get all messages with the ebusdctl command.
I also enabled the http interface, and it delivers raw json output to a browser.
So far so good. But when I try to use this json output to make a simple html page to show selected messages in elements like div (using javascript), this doesn’t seem to be so easy.
I can manually save de json data to a local file, and when I read this file into my page (using fetch api), it works just fine, I can display most messages In a div or other element.
But when I try to fetch the json directly from the url produced by the daemon (localhost:8889/data) , I run into the “same origin policy”: the requests are refused, even when they come from the same localhost where the daemon is running. The problem seems to be that the daemon delivers http on port 8889, and the html page uses port 80: not the same port, so “same origin policy” error.
I already tried several things:
Any ideas on how to show selected messages from the json output (or from TCP) in a simple html page using javascript?
Best regards, Marc
Beta Was this translation helpful? Give feedback.
All reactions