5

I am unable to get an XMLHttpRequest object to work correctly in a Dashboard widget I am writing. I've isolated it to a trivial example not working in the global scope of the main.js file:

    xhr = new XMLHttpRequest;
    xhr.open( 'GET', "http://google.com", false );
    xhr.send('');

When the last line is executed I get the error "ABORT_ERR: XMLHttpRequest Exception 102" (this is in the Dashcode debugger).

Does anyone have any idea what could be wrong here?

4 Answers4

9

You need to select "Allow Network Access" in the "Widget Attributes" pane.

David Beck
  • 10,099
  • 5
  • 51
  • 88
  • I assume this is refering to Dashcode, etc.? rather than manually mod/create of widget by hand in source code, which would be to mod Plist file as in other answers here. – David May 27 '12 at 04:37
6

OK, I've found it (three hours): you need to add the following key to the Info.plist file:

<key>AllowNetworkAccess</key>
<true/>
1

I've got the same trouble unresolved even after AllowNetworkAccess were added to my info.plist. I've tried to change this key to AllowFullAccess, but nothing changed. After system reboot it worked fine o_O

icanhazbroccoli
  • 1,035
  • 9
  • 15
  • I'm guessing widget needed a reload, but how else to reload other than system reboot? It might be cached otherwise prior to reboot. – David May 27 '12 at 04:39
1

The steps to take are:

  1. From the menu, choose "Dashcode > Preferences..." and click on the Destinations tab.
  2. Below the left column, click on the plus sign to create a new destination.
  3. For an external website, choose FTP in the Type drop down. Fill out the Server, Path, User name and Password. Close the Preferences pane.
  4. Back in Dashcode, click on the Widget Attributes icon in the left column.
  5. Check the boxes of Allow network Access and Allow External File Access in the main column.

You should be able to run the widget without the 102 Exception error (if you are online)

Jim McKeeth
  • 38,225
  • 23
  • 120
  • 194