I'm trying to create a very simple chrome extension for my school. I am fairly certain the underlying issue is that chrome doesn't allow XHR requests by default, but at the same time, was expecing the #results div ( here is the code ) to populate. I've read about certain things like jSONP, but then again, I'm not quite sure what's causing this. I'd appreciate any help! Thank you!
For chrome extensions to break cross-origin policies, you need to add the domain to your manifest file via the permissions entry:
"permissions": [
"tabs",
"bookmarks",
"http://slu.edu/",
"http://*.google.com/",
"unlimitedStorage"
],
Source: http://code.google.com/chrome/extensions/manifest.html#permissions
You are correct in thinking this was a cross-site issue. If you look at the Chrome console, you should see something like:
XMLHttpRequest cannot load http://slu.edu/peoplefinder/json/json_index.php?q= . Origin http://jsbin.com is not allowed by Access-Control-Allow-Origin.
If you're running this on a server with scripting capabilities (eg: PHP), you can create a script on your own server which will fetch the remote data instead of doing it in the browser.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.