Back to my page

Developers

How to open a new browser window?

Your widget might need to open a new browser window (or a popup window) for specific purposes. This would usually be done using the window.open method, but since UWA disables access to the window object, its open method is unavailable.

UWA therefore integrates a special method, called widget.openURL. It only takes one parameter, the needed URL.

widget.openURL('http://www.netvibes.com');

Note that this implementation is close to the W3C Widget specification's definition of the openURL method: you can't define the window name, nor can you specify its height, width, scrollbar…

Links in Apple Dashboard

The Dashboard uses a custom way of handling links, which means that standard <a href=”…” links will not work on their own: clicking them won't trigger a usual link request.

Using onclick=“openURL('http://...')” on links is the recommended way if you intend to make your widget fully work in Apple Dashboard. You can wrap it in a function :

function link(url)  {
  if (widget && widget.openURL) {
    widget.openURL(url);
    }
   }

…then using either the standard tag, or the span tag that Apple recommends.

<!-- This will not trigger in Dashboard -->
<a href="http://example.com">Example</a>
 
<!-- This should trigger on all platforms -->
<a href="http://example.com" onclick="link('http://example.com');">Example</span>
 
<!-- This is the recommended syntax for the Dashboard platform -->
<span onclick="link('http://example.com');">Example</span>
 
<!-- No need for a wrapper function... -->
<span onclick="widget.openURL('http://example.com');">Example</span>

See also the Dashboard documentation about widget.openURL.

Business

Click here if you want to know more about how netvibes can help you widgetize your brand and connect to your audience.

Developers

Click here to learn about netvibes open widget platform and you can create cool widgets for your service or your application that run everywhere.

Community

Click here to know how to join the netvibes community, get involved and help us translate and create a global directory of widgets for netvibes

Media

Click here to access informations about the company, our latest press release, our logos and media kit