Closed 3kmch closed 7 years ago
It's definitely possible, but it also presents a security issue because the js files would execute. If someone created a link to a malicious script, it could eventually blacklist the Maker.js site.
Generally my solution to this was to accept PRs and host the js here on the site. This would mean you would be sharing your code publicly.
If folks don't want their code to be public, we could have something like: Don't immediately execute external scripts, and show an "I agree" button that the user accepts the risk.
Thank you for your reply. :)
Sharing it on your site is a good solution. But I assume this would be a solution that depends on your spare time, so perhaps not an instant one. ;-)
So having the opportunity to add the js file directly would be awesome and having an [I agree] button sounds reasonable.
Another option to be aware of, is that it is pretty easy to host your own copy of the site, here on GitHub:
Ok, you can now specify an external script. You will see a warning screen, and the code will not auto-execute, you must click the Run button.
Cool, that was quick. :)
I tried to refer to http://microsoft.github.io/maker.js/playground/?script=http://3km.ch/makerjs/sleeve.js but got an error (message in browser):
Load module failure : Could not load script "http://3km.ch/makerjs/sleeve.js". Possibly a network error, or the file does not exist.
Message in console:
XMLHttpRequest cannot load http://3km.ch/makerjs/sleeve.js. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://microsoft.github.io' is therefore not allowed access.
Do you just allow files from github?
Actually it's the 3km.ch server which is not allowing the resource. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
In my example I used a GitHub Gist which was convenient, you may want to try it: https://gist.github.com/
OK, I git it; did it the GitHub way:
It just works. Thank you very much. :)
Sure :) Also have you tried running it on your local machine?
No, not yet.
Is it already possible to add an external file to the playground? This way I don't have to set up my own Maker.js platform. See also at OpenJSCAD: http://openjscad.org/#http://www.thingiverse.com/download:164128 (STL) or http://openjscad.org/#http://openjscad.org/examples/slices/tor.jscad