首页 > 其他分享 >答读者疑问:为什么我的 manifest.json 文件无法正确被加载试读版

答读者疑问:为什么我的 manifest.json 文件无法正确被加载试读版

时间:2022-12-25 22:13:26浏览次数:60  
标签:错误 试读 manifest json UI5 SAP 加载

有教程的读者向我提问:已经完成了下列两个步骤的学习:

自己本地 Visual Studio Code 开发了一个 SAP UI5 应用,使用命令行 ui5 serve 启动了本地开发服务器,访问 localhost:8080, 能够看到 index.html 和与其同处一个目录下的 manifest.json 文件。

然而点击 index.html 之后,应用程序无法正常被加载,出现白屏。在 Chrome 开发者工具 console 面板,出现下列的错误消息:

Access to XMLHttpRequest at 'https://sapui5.hana.ondemand.com/resources/singleFile/manifest.json?sap-language=EN' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

这个问题有点怪,明明应该从 localhost:8080 目录下去加载我们 SAP UI5 应用的 manifest.json 文件,为什么运行时实际上从这个错误的地址 https://sapui5.hana.ondemand.com/resources/singleFile/manifest.json?sap-language=EN 去加载了呢?

很显然 https://sapui5.hana.ondemand.com 上面是不可能存在我们应用程序自己编写的 manifest.json 文件的,所以这个错误消息从字面上看是一个跨域错误,实际上问题根源在于,我们自己编写的应用程序存在错误,导致 SAP UI5 框架引导程序从一个错误的地址去加载 manifest.json 文件。

下面是这个问题正确的修复方式

标签:错误,试读,manifest,json,UI5,SAP,加载
From: https://www.cnblogs.com/sap-jerry/p/17004693.html

相关文章