Chris Wang Chris Wang - 26 days ago 10
Javascript Question

Paper.js external file will not load

I am just trying to get into paper.js. Code works fine when they're inlined. But when I move them to an external file and src it there, errors starts to pop up :( Can anyone figure out what I did wrong? Error screenshot is attached

Much thanks!

Error screenshot



<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Paper.js Test</title>
<script type="text/javascript" src="bower_components/paper/dist/paper-full.min.js"></script>
<script type="text/paperscript" src="test.js" canvas="myCanvas"></script>
</head>
<body>
<canvas id="myCanvas" resize="true"></canvas>
</body>
</html>




Answer

From your screenshot, it is CORS ERROR.

You can fix CORS ERROR to test locally with https://www.thepolyglotdeveloper.com/2014/08/bypass-cors-errors-testing-apis-locally/

Comments