# Opening track hubs by URL

The `&hubURL=` query parameter opens a
[UCSC track hub](https://jbrowse.org/jb2/docs/user_guides/connections#ucsc-track-hub-url-format)
straight from a link, with no config file to set up first. Whoever opens the
link lands in JBrowse with the hub's assemblies and tracks already available.

## Basic usage

```text
https://jbrowse.org/code/jb2/latest/?config=none&hubURL=https://example.com/hub.txt
```

- `hubURL=` points directly at the hub's `hub.txt` file (the same URL you would
  paste into the connection form).
- `config=none` skips loading a JBrowse config, because the hub supplies its own
  assemblies and tracks. See [`?config=`](https://jbrowse.org/jb2/docs/urlparams#config).

JBrowse reads the hub's `shortLabel` and uses it as the session name.

## Combining with a config

Drop `config=none` and point [`?config=`](https://jbrowse.org/jb2/docs/urlparams#config) at a real
config when the launch needs something the hub does not have, such as plugins or
extra assemblies:

```text
?config=myconfig.json&hubURL=https://example.com/hub.txt
```

JBrowse adds the hub's tracks on top of whatever the config already defines.

## Opening the hub at a specific location

By default a hub opens at the location `defaultPos` states, in its `genomes`
stanza. Add [`&loc=`](https://jbrowse.org/jb2/docs/urlparams#loc) and
[`&assembly=`](https://jbrowse.org/jb2/docs/urlparams#assembly) to land somewhere else:

```text
?config=none&hubURL=https://example.com/hub.txt&assembly=GCF_019202715.1&loc=chr1:1-100000
```

`&assembly=` is required here, and it is the hub's genome ID — the same name the
hub's `genomes.txt` (or its `genome` line, for a one-file hub) uses. `&loc=` on
its own has no assembly to resolve against, so JBrowse loads the hub at its own
default location and says why. `&tracks=` works the same way, naming track IDs
the hub defines.

## Loading several hubs

Pass a comma-separated list to open more than one hub at once:

```text
?config=none&hubURL=https://example.com/hubA.txt,https://example.com/hubB.txt
```

Each hub appears in the track selector as a separate category.

## How a loaded hub behaves

Each hub URL becomes a UCSC track hub
[connection](https://jbrowse.org/jb2/docs/user_guides/connections) in the session, and from there it
behaves exactly like a connection you added by hand: lazily loaded, in a
dedicated category in the track selector, and only the tracks you open stored in
the session.

Hub tracks match to assemblies by genome ID, and the assemblies available are
whatever the hub has plus whatever a combined `?config=` defines, so a hub
opened with `config=none` shows only the tracks its own assemblies cover.

## See also

- [](https://jbrowse.org/jb2/docs/user_guides/connections) - adding the same hubs through the UI, the
  CLI, or a config
- [URL parameter API](https://jbrowse.org/jb2/docs/urlparams#huburl) - the full list of launch
  parameters, including `&hubURL=`
- [Live demo: a GenArk hub with no config](https://jbrowse.org/code/jb2/main/?config=none&hubURL=https://hgdownload.soe.ucsc.edu/hubs/GCF/019/202/715/GCF_019202715.1/hub.txt)

