views:

111

answers:

3

Hi all,

I am trying to have some fun with dashboard widgets, so I tried a simple application :

there will be a button over the widget which when clicked will open StackOverflow website in safari

To implement it, I tried this:

  1. Created a custom dashboard widget.
  2. Added a button to it from library.
  3. Associated gotoStackOverflow handler with onclick event.
  4. in body of function gotoStackOverflow, I wrote this code: window.open('http://stackoverflow.com/','Stackoverflow','width=400, height=300');

When I 'Run' the application I found no browser window appearing on click of the button.

Can anyone suggest me where I may be wrong or/ and some useful links to play with dashcode and dashboard widgets?

Thanks,

Miraaj

+1  A: 

Your code runs fine, when I recreate it. Maybe you have pop-ups blocked in Safari?

godswearhats
yes... it was blocked.. however it is still not working when I unblocked it:(
Miraaj
can we open the link in browser itself without displaying the pop-up window... like we have in google search widget?
Miraaj
+1  A: 

have you added

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

to the plist? if not the outside world will not be available.

PurplePilot
can you suggest me how to edit plist file for a widget being developed in dashcode?
Miraaj
I got it... the check box - Allow Network Access was deselected in Widget Attributes ... but it is still not working :(
Miraaj
A: 

I have used following code to solve my problem:

function gotoStackOverflow(event)
{
    widget.openURL("http://stackoverflow.com/");
}

cheers... :)

Miraaj

Miraaj