This documentation relates to previous versions of Titanium Studio.

To see the latest documentation, visit docs.appcelerator.com.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Actions
Table of Contents
maxLevel5
stylecircle
minLevel2
Requirements

The examples in this page use the Prototype library, which is included by default inside a portal. However, the same concepts may be applied using other implementations.

Invocation

This command is executed immediately in a synchronous way.

Open a page internally

When a page needs to be opened internally within Studio, use this JavaScript code to dispatch the appropriate action:

Code Block
languagejavascript
 
dispatch($H({
  controller : 'portal.browser',
  action : "internalOpen",
  args : ["http://www.appcelerator.com"].toJSON()
}).toJSON());
Open a page externally

When a page needs to be opened externally in the OS default browser, use this JavaScript code to dispatch the appropriate action:

Code Block
languagejavascript
 
dispatch($H({
  controller : 'portal.browser',
  action : "externalOpen",
  args : ["http://www.appcelerator.com"].toJSON()
}).toJSON());
Open a page in the Studio's default browser

This call will open the URL in the Studio's default browser, as defined in the preferences. Use this JavaScript code to dispatch the appropriate action:

Code Block
languagejavascript
 
dispatch($H({
  controller : 'portal.browser',
  action : "openURL",
  args : ["http://www.appcelerator.com"].toJSON()
}).toJSON());

Note: Since Aptana Studio 3.3.0

Example

You may place that dispatch code above inside a link listener, just like that:

Code Block
languagejavascript
myLink = $('my-link');
myLink.observe('click', function(e) {
  if (typeof(dispatch) !== 'undefined') {
    dispatch($H({
      controller : 'portal.browser',
      action : "externalOpen",
      args : ["http://www.appcelerator.com"].toJSON()
    }).toJSON());
  }
  return false;
});