Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support web #19

Open
mafreud opened this issue Sep 26, 2022 · 3 comments
Open

support web #19

mafreud opened this issue Sep 26, 2022 · 3 comments

Comments

@mafreud
Copy link
Owner

mafreud commented Sep 26, 2022

No description provided.

@ykhedar
Copy link

ykhedar commented Jul 1, 2023

Hi,
nice package!
do you have some idea on how you would go about adding support for the web. I am currently testing the package on flutter web but get CORS errrors. It seems that the Weatherkit API was not designed for Web Browsers? If it's possible to solve it on the client side, maybe i can try and raise a PR if it works.

Thanks.

@mafreud
Copy link
Owner Author

mafreud commented Jul 1, 2023

Hi!
What errors do you have? I will take a look later.

@ykhedar
Copy link

ykhedar commented Jul 1, 2023

On Chrome Browser:

`dashboard:1 Access to XMLHttpRequest at 'https://weatherkit.apple.com/api/v1/weather/en/XX.XXXXX/XX.XXXXX?dataSets=currentWeather,forecastDaily,forecastHourly,forecastNextHour' from origin 'https://XXXXX.XXXXXX.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.

main.dart.js:48096 XMLHttpRequest error.

weatherkit.apple.com/api/v1/weather/en/XX.XXXXX/XX.XXXXX?dataSets=currentWeather,forecastDaily,forecastHourly,forecastNextHour:1 Failed to load resource: net::ERR_FAILED
`

I masked the coordinates my app url. But it seems that ideally the remote API (Apple Weatherkit in this case) should allow requests from * origin if it wants to support Web Browsers. It seems not to be the case, making me wonder if the API was only designed for native apps. The pre-decessor of this API, DarkSky worked perfectly in browsers as well.

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

No branches or pull requests

2 participants