I am experimenting with the new Safari 5 extensions JS API and I am having an issue right from the 开发者_JAVA技巧ground up, I want to use an XMLHttpRequest to get an RSS feed from a website however upon the .send() it immediatly kicks off errors:
Failed to load resource: cancelled
Then looking at the XMLHttpRequest object is says in status: Error: INVALID_STATE_ERR: DOM Exception 11
I don't know why but this is my code, I hope I can get some advice as to whats going wrong:
var xml = new XMLHttpRequest();
xml.open('GET', 'http://year3.gdnm.org/feed/');
xml.send();
Thanks in advance.
Make sure that in Extension Builder you have given your extension access to the site. Under the heading "Extension Website Access" set the access level to "all" or set it to "some" and provide "year3.gdnm.org" as an allowed domain pattern.
I had the same problem, and the fix for me was to add:
http://\*/\*
https://\*/\*
to my whitelist.
After that everything worked as expected.
Looks like there is bug because the documentation says that leaving the whitelist empty is equivalent to what I added.
https://developer.apple.com/library/archive/documentation/Tools/Conceptual/SafariExtensionGuide/ExtensionPermissions/ExtensionPermissions.html
There may be an error in XML of page "http://year3.gdnm.org/feed/" and Safari couldn't parse this document, hence the error.
精彩评论