为什么 CORS 有效?我预计它会失败
Why is CORS working? I expected it to fail
我想了解 CORS 在这种情况下是如何工作的,而无需我进行任何服务器端配置(下面是完整的网络时间线屏幕截图)
我正在开发一个 web app,最初是 Chrome 扩展原型。它有一个 chrome 清单,像这样
{
"name": "How to lose clients and annoy coworkers",
"description": "Useful tips for more unproductive living",
"version": "0.2",
"chrome_url_overrides": {
"newtab": "index.html"
},
"options_ui": {
"page": "options.html",
"chrome_style": true
},
"icons": {
"16": "images/all-skin-types-16x16.png",
"48": "images/all-skin-types-48x48.png",
"128": "images/all-skin-types-128x128.png"
},
"manifest_version": 2,
"permissions": [
"storage",
"tabs",
"https://sheetsu.com/apis/2e55358e/*"
]
}
然后我决定将它变成一个基于 Web 的应用程序,希望能够解决向 https://sheetsu.com/apis/2e55358e/*
发出请求的问题,这是一个 Google Spreadsheet backend。但它在 Chrome 和 Firefox 中无需任何更改即可工作。我试图向 Twitter 发出另一个请求,但失败了。
我想可能是因为 [Chrome extension manifest.json][3]
但当我将 https://twitter.com
添加到权限列表时,它仍然失败。
而且我还能够向 https://sheetsu.com/apis/2e55358e
发出 POST 请求
Access-Control-Allow-Origin
@https://sheetsu.com/apis/2e55358e
列出了您的域 (iampeterbanjo.github.io
),但 twitter.com
没有。
我想了解 CORS 在这种情况下是如何工作的,而无需我进行任何服务器端配置(下面是完整的网络时间线屏幕截图)
我正在开发一个 web app,最初是 Chrome 扩展原型。它有一个 chrome 清单,像这样
{
"name": "How to lose clients and annoy coworkers",
"description": "Useful tips for more unproductive living",
"version": "0.2",
"chrome_url_overrides": {
"newtab": "index.html"
},
"options_ui": {
"page": "options.html",
"chrome_style": true
},
"icons": {
"16": "images/all-skin-types-16x16.png",
"48": "images/all-skin-types-48x48.png",
"128": "images/all-skin-types-128x128.png"
},
"manifest_version": 2,
"permissions": [
"storage",
"tabs",
"https://sheetsu.com/apis/2e55358e/*"
]
}
然后我决定将它变成一个基于 Web 的应用程序,希望能够解决向 https://sheetsu.com/apis/2e55358e/*
发出请求的问题,这是一个 Google Spreadsheet backend。但它在 Chrome 和 Firefox 中无需任何更改即可工作。我试图向 Twitter 发出另一个请求,但失败了。
我想可能是因为 [Chrome extension manifest.json][3]
但当我将 https://twitter.com
添加到权限列表时,它仍然失败。
而且我还能够向 https://sheetsu.com/apis/2e55358e
Access-Control-Allow-Origin
@https://sheetsu.com/apis/2e55358e
列出了您的域 (iampeterbanjo.github.io
),但 twitter.com
没有。