I downloaded Apple's very simple Hello World example.
I added some very simple XMLHttpRequest code.
It fails.
And Console tells me this:
And I can't find any help on that through Google.
My Info.plist (so you can see I'm using AllowNetworkAccess):
And now the HelloWorld.html file:
Now, this works perfectly fine in Safari. But as a widget, it keeps "Hello, World!" and throws the error above in Console.
Any insight on this would be greatly appreciated.
I added some very simple XMLHttpRequest code.
It fails.
And Console tells me this:
Code:
2/26/08 9:23:38 AM [0x0-0x7007].com.apple.dock[149] 2008-02-26 09:23:38.678 DashboardClient[524:10b] (com.apple.widget.helloworld) file:///Users/anthony/Library/Widgets/Hello%20World.wdgt/HelloWorld.html: NETWORK_ERR: XMLHttpRequest Exception 101 (line: 18)
And I can't find any help on that through Google.
My Info.plist (so you can see I'm using AllowNetworkAccess):
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>Hello World</string>
<key>CFBundleIdentifier</key>
<string>com.apple.widget.helloworld</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CloseBoxInsetX</key>
<integer>16</integer>
<key>CloseBoxInsetY</key>
<integer>14</integer>
<key>MainHTML</key>
<string>HelloWorld.html</string>
<key>AllowNetworkAccess</key>
<true/>
</dict>
</plist>
And now the HelloWorld.html file:
Code:
<html>
<head>
<style>
body {
margin: 0;
background-image: url("Default.png");
}
</style>
<script language='JavaScript'>
function UpdateData () {
var request = new XMLHttpRequest();
request.open("GET", "http://www.whatismyip.com",false);
request.send();
myInfo = request.responseText;
document.getElementById("myDiv").innerHTML = myInfo;
}
</script>
</head>
<body onload="UpdateData();">
<div id='myDiv'>Hello, World!</div>
</body>
</html>
Now, this works perfectly fine in Safari. But as a widget, it keeps "Hello, World!" and throws the error above in Console.
Any insight on this would be greatly appreciated.