In the same file directory, that is, html files and json files are accessed directly with ajax in the same directory, and cross-domain errors are reported.

in the same file directory, the html page uses ajax to request the json file. There is no problem in opening it in hbuilder. If you open the page directly in the folder, you will report a cross-domain error. How to solve this problem

Mar.18,2021

the file:// protocol that opens local files directly cannot use xhr, and a local server must be built.

Menu