History

The History action set allows you to use the JavaScript History API to modify the top-level browser URL without navigating. Use the History action set to update the top-level browser URL to match your app.

Setup

Create an app and import the History module from @shopify/app-bridge/actions. Note that we'll be referring to this sample application throughout the examples below.

Push a new history entry containing the relative app path

The path is relative to the app origin and must be prefixed with a slash. Adding a history entry does not redirect the app:

Replace the current history entry with the relative app path

The path is relative to the app origin and must be prefixed with a slash. Replacing the history entry does not redirect the app:

Subscribe to actions

You can subscribe to actions dispatched through the specific history action set:

Subscribe to all history actions

You can subscribe to all history actions, regardless of which action sets trigger the actions: