DEV Community

[Comment from a deleted post]
Collapse
 
qm3ster profile image
Mihail Malo

You cannot, because requests from scripts are even more limited than from html.
That paradoxical limitation is why JSONP exists.
If you just want to distribute a file, you can bundle everything into one html file with webpack or similar.
However, if you want to host it, just host it already, and you will be able to request json (at least from the same exact domain), it's just file:// that is not allowed.