jquery - 在 node-webkit 中使用 JQuery 是不可能的

标签 jquery node.js node-webkit

我正在尝试在node-webkit 0.12.3版本中使用jquery。我通过添加

成功完成了此操作
<script src="js/jquery-2.1.4.js" type="text/javascript"></script>

到我的index.html。

我已经在版本 0.12.2 中成功完成了此操作,但现在我收到一个我无法理解的错误。我在日志中收到警告。

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.

紧接着出现错误

Failed to load resourcejquery-2.1.4.js:8630 file:///.../jquery-2.1.4.js send

这是下面一行 xhr.send( options.hasContent && options.data || null );

我读到,我访问另一个应用程序的文件系统可能会出现问题,但这是不正确的。

我做错了什么?

最佳答案

你应该像“superagent”一样使用nodejs模块而不是ajax。如果你想使用 jquery,你应该托管本地 http 服务器并在你的服务器上添加 cros 域;

关于jquery - 在 node-webkit 中使用 JQuery 是不可能的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32612163/

相关文章:

Node-Webkit (nwjs) 如何将窗口向右对齐?

javascript - 如何使用 browserify 在客户端 html 文档中使用 Node.js 包

javascript - 在 javascript/jQuery 中检测 ctrl+tab 按键按下

jquery - 滚动事件 react 缓慢

javascript - 如何使用 import module 语法重写此 require 模块

javascript - Angular JS 自动更新事件 View

javascript - 确定 Chrome 中当前 DOM 元素状态

node.js - 模块路由分离

C 函数将函数作为参数传递,如何使用 node-ffi 包装此函数?

node.js - 流读取在nodejs中返回空