我正在尝试为自己编写一个 chrome 扩展,但其中的以下几行似乎失败了:
fk_url = "http://www.flipkart.com/search-books?query=" + search + "algorithms&from=all";
$.get(fk_url);
而且,当我的扩展运行时,它给了我这个错误:
XMLHttpRequest cannot load <a href="http://www.flipkart.com/search-books?query=algorithmsalgorithms&from=all" rel="noreferrer noopener nofollow">http://www.flipkart.com/search-books?query=algorithmsalgorithms&from=all</a>. Origin chrome-extension://cpepfejkgdnhemablbikonijfjnjmnha is not allowed by Access-Control-Allow-Origin
.
我完全不知道如何解决这个问题。有什么帮助吗? (我尝试连接的网站不提供 API)
最佳答案
您的 manifest.json
文件应包含您要在权限中使用的域:
"permissions": [
"http://*.flipkart.com/"
]
关于javascript - Chrome 扩展,Jquery ajax 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6004565/