sb:GenerateBar

The sb:GenerateBar function will add a new bar to the list of bars available to the browser.

The parameters are:

type
The type of bar to add:

  • 1 = toolbar;
  • 2 = sidebar;
  • 3 = footer-bar;
  • 4 = explorer bar.
internal name
A name by which you can identify the bar. It's important that this is unique since it will be used internally by the browser to link the bar to any menus, and is also used to identify the bar when calling sb:RemoveBar to remove it. This should be completely alphabetic.
menu entry
A name for the bar that will be used in the browser menu.
URL
The location of the bar. This can be on the internet, which does make it very easy to add new functionality to the bar without requiring a download.

The return value will be "Success" if successful, otherwise an error description.

Example

A typical use would be to invoke the function, and then show a message. The message could indicate success or failure:

<xf:action ev:event="my-install-bar">
  <xf:setvalue
   ref="@retval"
   value="sb:GenerateBar(
    string(../type),
    string(../internalName),
    string(../name),
    string(../uri)
   )"
  />
  <xf:message level="modal">
    '<xf:output ref="name" />'
    has
    <xf:output value="
      if(
        @retval = 'Success',
        ' been added. You will need to open a new browser window to see the change.',
        concat(' failed to install. The error is &#34;', @retval, '&#34;.')
      )"
    />
  </xf:message>
</xf:action>