hubcap new

Open a new browser tab.

When to use

Use new to open a new browser tab, optionally navigating to a URL. Use the -target global flag to interact with the new tab afterward.

Usage

hubcap new [--wait] [url]

Arguments

ArgumentTypeRequiredDescription
urlstringNoURL to open in new tab (defaults to about:blank). If no scheme is provided, https:// is prepended automatically.

Flags

FlagTypeDefaultDescription
—waitboolfalseWait for page load to complete

Output

FieldTypeDescription
targetIdstringUnique identifier for the new tab
urlstringThe URL opened in the new tab
loadedboolWhether the page loaded (only with —wait)
{"targetId":"A1B2C3D4E5F6","url":"about:blank"}

With --wait:

{"targetId":"A1B2C3D4E5F6","url":"https://example.com","loaded":true}

Errors

ConditionExit codeStderr
Chrome not connected2error: connecting to Chrome: ...
Tab creation timeout3error: timeout

Examples

Open a blank new tab:

hubcap new

Open a new tab and navigate to a URL:

hubcap new example.com

Open a tab and wait for the page to fully load:

hubcap new --wait example.com

Open a tab and capture its ID for later use (chaining):

TAB_ID=$(hubcap new --wait example.com | jq -r '.targetId') && hubcap -target "$TAB_ID" title

See also

  • close - Close a browser tab
  • tabs - List open browser tabs
  • goto - Navigate an existing tab to a URL