Chrome Extension: XMLHttpRequest Canceled (status == 0)
I try to load a json file from a server with XMLHttpRequest. But I only get status==0 and the chrome dev console says: '(canceled)' I can reproduce this with this (simplified) code
Solution 1:
The error you're getting is a sign that a redirect was performed, to an URL which does not match any of your declared permissions.
To verify my statement, add the *://*/*
or <all_urls>
permission to the manifest file, and you will notice that the request completes successfully.
To determine which redirects are followed, follow the following steps:
- Open the developer tools, go to the Network tab.
- Paste the URL in the omnibox, and hit enter
- Read the URLs in the developer tools.
As you can see in the previous picture, dl.dropbox.com
actually redirects to dl.dropboxusercontent.com
. This domain has to be added to the permission section of your manifest file, to fix the problem:
"permissions": [
"http://theOtherWorkingServer.com/*",
"*://dl.dropbox.com/*",
"*://dl.dropboxusercontent.com/*"
],
(the the wildcard at the scheme matches http
and https
- see match patterns)
Post a Comment for "Chrome Extension: XMLHttpRequest Canceled (status == 0)"