如何在本地启动部署的Angular应用

huangapple go评论85阅读模式
英文:

How to start deployed Angular application locally

问题

我已部署了Angular前端,在服务器上它工作正常,有三个脚本:

/runtime.0fad6a04e0afb2fa.js
/polyfills.24f3ec2108a8e0ab.js
/main.a9b28b9970fe807a.js

我想在Firefox中启动这个应用程序,不使用IIS或Apache,只需点击Html页面。这可能吗?

但Firefox告诉我:

跨源请求被阻止:同源策略禁止读取file:///runtime.0fad6a04e0afb2fa.js上的远程资源。 (原因:CORS请求不是HTTP)。

是否可能解除此限制?或者Firefox永远不允许我加载和运行这些脚本?

英文:

I have deployed Angular frontend, on server it working fine, there are 3 script

/runtime.0fad6a04e0afb2fa.js    
/polyfills.24f3ec2108a8e0ab.js    
/main.a9b28b9970fe807a.js    

I want to start this application in Firefox, without IIS or Apache - by simple click to Html-page. Is it possible?

But Firefox said me

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///runtime.0fad6a04e0afb2fa.js. (Reason: CORS request not http). 

Is it possible to remove this restriction? Or Firefox never allow me loading and working this scripts?

答案1

得分: 1

这是一个CORS策略错误,您需要在类似nodejs HTTP-server的http服务器上运行应用程序。

英文:

Its a CORS policy error, you need to run applications on an http-server like
nodejs HTTP-server

huangapple
  • 本文由 发表于 2023年2月23日 20:54:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/75545121.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定