jeffseo / ChampionMasteryPlanner

A tool for League of Legends users to plan out how many games are needed to obtain the champion points they want
1 stars 0 forks source link

multiple domain issue #4

Closed jeffseo closed 8 years ago

jeffseo commented 8 years ago

Currently, the script is managed through client-side javascript. Apparently this can cause issues when we attempt to access multiple domains (which is required for Riot API). The issue I see is:

XMLHttpRequest cannot load https://na.api.pvp.net//championmastery/location/NA1/player/29484755/champions?api_key=174ef72a-54df-4458-ae37-fa609507cbda. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

This is related to the championMastery api which returns a response header Access-Control-Allow-Origin: riot.development.ca (or something like this).

Other api commands generally return Access-Control-Allow-Origin: * which allows multiple domain connections.

Possible solution is to perhaps use JSONP or investigate into hosting a server side script that can request properly(?). Investigate and fix.

(On Safari, there is none of this issue and works perfectly fine)