开发者

Use of XMLHttpRequest in Dashboard widget failing

开发者 https://www.devze.com 2022-12-30 02:15 出处:网络
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:

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 开发者_StackOverflow中文版get the error "ABORT_ERR: XMLHttpRequest Exception 102" (this is in the Dashcode debugger).

Does anyone have any idea what could be wrong here?


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


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

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


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


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消