Use of XMLHttpRequest in Dashboard widget failing
Asked Answered
T

4

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?

Thimbleful answered 8/5, 2010 at 0:32 Comment(0)
C
9

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

Configuration answered 10/7, 2010 at 22:16 Comment(1)
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.Liscomb
T
6

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

<key>AllowNetworkAccess</key>
<true/>
Thimbleful answered 8/5, 2010 at 1:25 Comment(0)
G
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

Genetics answered 26/8, 2010 at 4:53 Comment(1)
I'm guessing widget needed a reload, but how else to reload other than system reboot? It might be cached otherwise prior to reboot.Liscomb
S
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)

Stemson answered 29/8, 2010 at 3:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.