Skip to content
This repository has been archived by the owner on Nov 4, 2023. It is now read-only.

Cross origin errors: failed to load head and tile #52

Closed
rogersmj opened this issue Jun 29, 2018 · 7 comments
Closed

Cross origin errors: failed to load head and tile #52

rogersmj opened this issue Jun 29, 2018 · 7 comments

Comments

@rogersmj
Copy link
Contributor

rogersmj commented Jun 29, 2018

I'm trying to run TileBoard locally on my Mac, just by opening up index.html in my browser (as suggested in the Community thread) and have it talk to Hass.io running on a RPi. It is receiving events from HA just fine.

However, it's throwing errors about cross-origin requests and I don't get anything showing on my board:

image

I'm guessing this is because it's being run from a file:// protocol. If that's going to be a problem, the project should maybe be bundled with a really simple web server?

@rogersmj
Copy link
Contributor Author

rogersmj commented Jun 29, 2018

Never mind, I spotted this in the README:

Note: If you are opening index.html file locally in Google Chrome than you will face an issue of tiles not being displayed and see an error about cross origin requests not being supported in file:// protocol. in browser's console. You can overcome the problem by starting Chrome with --allow-file-access-from-files switch or simply open the page in Firefox.

Still wonder if it should include an optional web server? Closing for now.

@resoai
Copy link
Collaborator

resoai commented Jun 29, 2018

I think we would simply ask people to copy files to www directory

@Evgeny- Evgeny- reopened this Jun 29, 2018
@Evgeny-
Copy link
Collaborator

Evgeny- commented Jun 29, 2018

I've reopened it.
I think most people are using google chrome and open file directly in the browser. So most of users are get this error. And who knows how much of them are left project on this step.
So my suggestions:
a) Detect if file opened in chrome via file:// protocol, and then saying to user that is not gonna work
b) Use some plugin for development that will compile html templates right into the one js file
c) Put all templates directly into index.html file, using something like <script type="template"></script>
d) Create a simple webserver with w.g. python

For this project, I'll suggest use c) solution. It's simple and don't require any compilations.

Evgeny- added a commit that referenced this issue Jun 29, 2018
Evgeny- added a commit that referenced this issue Jun 29, 2018
@rogersmj
Copy link
Contributor Author

@resoai , I don't want to do that because my HA server is open to the Internet so I can access it remotely. With the way this project is currently setup, wouldn't dropping this in the www folder expose my config, most importantly my HA password?

Seems like option (c) above would be the best short-term quick fix.

@resoai
Copy link
Collaborator

resoai commented Jun 29, 2018

Homeassistant will soon move to oauth2 which will fix all our problems

@Evgeny-
Copy link
Collaborator

Evgeny- commented Jun 30, 2018

This problems already solved

@resoai resoai closed this as completed Jun 30, 2018
@amkochaki
Copy link

Hello

I'm accessing my HA via duckdns, but tested it having problems accessing Tilebord, what appears to me is only the background screen and the screensaver also appears. I can access the files from the tileboard directories as well. But I don't know what the screens are not showing. Can someone help me with this please?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants