- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
let dataObj = [];
const query = 'marvel';
fetch(`https://en.wikipedia.org/w/api.php?action=query&titles=${query}&prop=revisions&rvprop=content&format=json&formatversion=2`)
.then(data => data.json())
.then(data => dataObj.push(data))
.catch(err => console.log(err));
这是我收到的错误:
No '
Access-Control-Allow-Origin
' header is present on the requested resource. Origin 'https://s.codepen.io' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors
' to fetch the resource with CORS disabled.
我将模式设置为 no-cors
但还是不行。
最佳答案
尝试添加查询参数 origin=*
来帮助解决 CORS 问题:
https://en.wikipedia.org/w/api.php?action=query&titles=${query}&prop=revisions&rvprop=content&format=json&formatversion=2&origin=*
希望对您有所帮助!
关于javascript - 无法从维基百科 API 获取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48604705/
好吧,我看过一些帖子提到其他一些关于不使用 SP wiki 的帖子,因为它们很糟糕。 既然我们正在考虑在 SP 中创建 wiki,我需要知道为什么我们不应该让 6 名自动化开发人员来记录各种自动化流程
在 GitLab Wiki 部分,可以查看保存更改的历史记录。但是,当您单击提交链接时,它将显示该保存中存在的整个文件。有谁知道一种方法来区分提交以仅获取两个提交之间的差异? 这类似于它在 merge
我使用了 Wiki API 文档中的一些示例代码,但是当我输入搜索项时,没有任何反应。控制台中没有错误,什么也没有。如果我将 URL 输入到浏览器中,URL 本身就会起作用,所以我认为代码中的某些内容
我想在我的 wiki 中创建一个层次结构,如下所示: General FooPages Foo1 Foo2 Foo3 ODP Bar Baz 我想创建这些页
我正在尝试使用为 Python 制作的 Wikimapia 的 pymapia API,但无法理解如何正确使用它。 import pymapia as PyMapia a = PyMapia.PyMa
我正在开发适用于 iOS 的客户端应用程序,用于在 Mac OS X 服务器(Snow Leopard 和 Lion)上编辑内置的 Wiki/Blog。 看来我们可以使用 MetaWeblog 、At
我正在编写一些 URL 重写软件,我想从多个角度了解哪种 URL 方案更可取: 博客风格:my-chemistry-answer -- 为什么? -- (不可取,技术性) Wiki 风格:My_Che
我一直试图找到一种方法来在 Azure DevOps Wiki 中创建子页面的目录。我从其他 wiki 服务中找到了方法。 在 Confluence 中,他们有一个用于“ child 显示”的宏 我为
我是一名优秀的程序员,十分优秀!