How to insert trigonometrical shape in webpage?

前端 未结 1 1874
无人共我
无人共我 2021-01-25 23:10

I am working a project in which I have to insert thousands of trigonometrical shape in a webpage. Basically I\'m working on a project of converting an ancient book in html. But

相关标签:
1条回答
  • 2021-01-25 23:41

    I tried to setup the example and ran into two issues. I'll explain how to solve those. However, before you do this, try opening your own example again. After I fixed the issues, I went back to look more closely at the problems, but.. it worked. There is a small chance that the maintainer of the files adjusted the CORS-Headers just while I tried this out - so maybe your problem solved itself. In case it doesn't work for you just like that, here is how I solved the initial problems:

    1. The library doesn't allow requests from other domains, so you can't just include the JS file from tikzjax.com. To solve this, you have to download the source files and put them in the same folder. The js file itself is not enough, you have to download these files:
      https://tikzjax.com/v1/tikzjax.js
      https://tikzjax.com/ef253ef29e2f057334f77ead7f06ed8f22607d38.wasm. https://tikzjax.com/7620f557a41f2bf40820e76ba1fd4d89a484859d.gz
      Then change your script tag to that local js file: <script src="./tikzjax.js">

    2. The script uses fetch to get other files, and this is not working, when opening the page with the file:// protocol (you'll get this error message in the console: Fetch API cannot load file:///ef253ef29e2f057334f77ead7f06ed8f22607d38.wasm. URL scheme must be "http" or "https" for CORS request.
      So you have to setup a local webserver to show the page on e.g. http://localhost:8080. If you're comfortable with the command line, you can use the npm package http-server for such cases. If you haven't installed npm and/or node, you can install it from here (npm is installed with node). Then run the command npm install -g http-server. Then navigate to the folder where your html and js files are (in the terminal) and execute http-server. This will setup the server and the circle should render there.

    0 讨论(0)
提交回复
热议问题