CRecordWebOpenNewTab

The message CRecordWebOpenNewTab opens a new tab in the browser.

The message is part of the RemoteSkin Web API.
The API is located in the plugin NY_RemoteSkinWebProtocolAPI.

{
  "id": "59a20942-af1b-43c1-ade6-e8a2f60e69aa",
  "name": "WEB_OPEN_NEW_TAB",
  "description": "Opens a new tab in the browser with this URL.",
  "slots": [
    {
      "key": "1",
      "name": "SAME_URL",
      "direction": "REQUEST",
      "mandatory": "true",
      "type": "BOOLEAN",
      "description": "True: Uses the URL of the running application."
    },
    {
      "key": "2",
      "name": "URL",
      "direction": "REQUEST",
      "mandatory": "false",
      "type": "STRING",
      "description": "Optional: The URL to open."
    },
    {
      "key": "3",
      "name": "PARAMETER",
      "direction": "REQUEST",
      "mandatory": "true",
      "type": "STRING_PROPERTIES",
      "description": "Optional: Parameters."
    }
  ]
}

Arguments

  • SAME_URL : If this argument is true, the same URL is used as that of the running application.
  • URL: If SAME_URL is false, this URL is used.
  • PARAMETER: The URL parameters to be provided. Please do not enter a session ID, as this will be inserted automatically. The short version of the session ID is used.

Usage with the helper class CWebApi

The easiest way is to call the corresponding method in the CWebApi class. The use of the class is described there.

The session token is also required.

mWebApi.openNewTab(final boolean aSameUrl,
                   @Nullable final String aUrl,
                   @Nullable final CStringProperties aProperties,
                   final byte[] aSessionToken);

Usage as message

The RemoteSkin target address and the session token are also required.

public void openNewTab(final byte[] aSessionToken,
                       @NotNull final CTargetAddress aRemoteSkinAddress,
                       final boolean aSameUrl,
                       @NotNull final String aUrl,
                       @NotNull final CStringProperties aParameter) throws CException
{
    // Envelope
    final CEnvelope env = CEnvelope.forSingleTarget(mRemoteSkinAddress);
    env.setSessionToken(aSessionToken);
    
    // Record
    final CRecord record = CRecordWebOpenNewTab.create();
    CRecordWebOpenNewTab.setSameUrl(record,
                                    aSameUrl);
    CRecordWebOpenNewTab.setUrl(record,
                                aUrl);
    CRecordWebOpenNewTab.setParameter(record,
                                      aParameter);
    
    // send message
    sendNotification(env,
                     record);
}

See also: