unknowndomain
unknowndomain

Reputation: 985

Safari 5 Extension XMLHttpRequest Error: INVALID_STATE_ERR: DOM Exception 11

I am experimenting with the new Safari 5 extensions JS API and I am having an issue right from the 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.

Upvotes: 1

Views: 5634

Answers (3)

lampis
lampis

Reputation: 41

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

Upvotes: 3

Scott Thompson
Scott Thompson

Reputation: 23701

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.

Upvotes: 3

mav
mav

Reputation: 1248

There may be an error in XML of page "http://year3.gdnm.org/feed/" and Safari couldn't parse this document, hence the error.

Upvotes: 1

Related Questions