javascript - RequireJS + NodeJS 返回 XMLHttpRequest 无法加载 'http' 没有 'Access-Control-Allow-Origin' header

标签 javascript node.js requirejs jssip

我尝试使用 JsSIP,但是当我使用 RequireJS 在客户端 CHROME 中启用 require 时返回:

XMLHttpRequest 无法加载 http://localhost/videochat/videonodejs/scripts/jssip。请求的资源上不存在“Access-Control-Allow-Origin” header 。因此,不允许访问源“http://localhost:3000”。

一切都在本地主机中,那么起源问题可能是什么?我的 URL 中确实有端口号,可能是这样吗?

最佳答案

jssip 请求位于端口 80,应用程序位于端口 3000。根据同源策略,它们不是同源。

关于javascript - RequireJS + NodeJS 返回 XMLHttpRequest 无法加载 'http' 没有 'Access-Control-Allow-Origin' header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27235796/

相关文章:

javascript - DOM Ready后设置Cookie影响样式/调用函数

node.js - Node.js、Redis、套接字

javascript - 在node.js中使用es6类有用吗?

javascript - 如何异步查询多条SQL?

node.js - 如何查找 Node.js UnhandledPromiseRejectionWarning 中哪些 Promise 未处理?

jquery - RequireJS + jQuery 命名空间问题

javascript - jquery.fileupload 插件导致 require.js 随机导入失败

javascript - 路由在 Angularjs 上不起作用

javascript - 使用位掩码确定是否设置了 2 个或更多 bool 值

javascript - 找到最接近的类并设置数据属性