Simple dashboard application
-
17-09-2020 - |
質問
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:
- Created a custom dashboard widget.
- Added a button to it from library.
- Associated gotoStackOverflow handler with onclick event.
in body of function gotoStackOverflow, I wrote this code:
window.open('https://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?
解決 3
I have used following code to solve my problem:
function gotoStackOverflow(event)
{
widget.openURL("http://stackoverflow.com/");
}
cheers... :)
Miraaj
他のヒント
Your code runs fine, when I recreate it. Maybe you have pop-ups blocked in Safari?
have you added
<key>AllowNetworkAccess</key>
<true/>
to the plist? if not the outside world will not be available.