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
<scripttype="text/javascript">$(document).ready(function(){varproject_rtd_id=123456;/* see https://docs.readthedocs.io/en/stable/api/v2.html#project-versions */$.ajax({/* crossDomain: true, */url: "https://readthedocs.org/api/v2/project/"+project_rtd_id.toString()+"/active_versions/",/* dataType: "jsonp", */success: function(data){$.each(data.versions,function(index,value){varversion_name=value.slug;/* do something with version_name */});},error: function(){console.error('Error loading the RTD API endpoint');},});});</script>
Actual Result
I receive browser errors regarding CORS violations as soon as this page is deployed to github.io:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://readthedocs.org/api/v2/project/<myProjectID>/active_versions/. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
I believe this is caused by a missing HTTP header at the endpoint. We can fix this by adding Access-Control-Allow-Origin: * for responses from readthedocs.org/api/v2/. As a side note, support for JSONP would also be really awesome for v3 :)
The text was updated successfully, but these errors were encountered:
ax3l
added a commit
to ECP-WarpX/ecp-warpx.github.io
that referenced
this issue
Sep 8, 2019
Details
Live page: https://ecp-warpx.github.io
Source: https://github.com/ECP-WarpX/ecp-warpx.github.io
Expected Result
I am trying to query the public RTD API endpoint https://docs.readthedocs.io/en/stable/api/v2.html#project-versions from a github.io page with jQuery.
Actual Result
I receive browser errors regarding CORS violations as soon as this page is deployed to
github.io
:I believe this is caused by a missing HTTP header at the endpoint. We can fix this by adding
Access-Control-Allow-Origin: *
for responses fromreadthedocs.org/api/v2/
. As a side note, support for JSONP would also be really awesome for v3 :)The text was updated successfully, but these errors were encountered: