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

Access to XMLHttpRequest has been blocked by CORS policy #53

Open
minglaitin opened this issue Jul 10, 2021 · 1 comment
Open

Access to XMLHttpRequest has been blocked by CORS policy #53

minglaitin opened this issue Jul 10, 2021 · 1 comment

Comments

@minglaitin
Copy link

I was trying to load a local SVG file into my html but it was not successful

<head>
  <script src="svg-inject.js"></script>
</head>
<body>
  <img src="earth.svg" onload="SVGInject(this)">
</body>

I opened the console and found the following warning
SQLInject_issue

How can I deal with this issue?

@xmyhoang
Copy link

xmyhoang commented Aug 8, 2021

You should consider using a local web server to let your browser render local files in http. I used the command python3 -m http.server in the terminal to open my file and now it works.

Consult this stack overflow post for more details and other solutions beside using python: https://stackoverflow.com/questions/10752055/cross-origin-requests-are-only-supported-for-http-error-when-loading-a-local

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