Skip to main content

Navigation API

Info

App Bridge isn't versioned with Polaris. App Bridge APIs and web components are identical in every App Home reference version.

The Navigation API lets you navigate within and outside of your app using the HTML anchor element. You can also modify the top-level browser URL with or without navigating using the History API or the browser's native Navigation API.

  • App routing: Navigate between pages within your app using HTML anchor elements.
  • URL management: Modify the top-level browser URL without triggering full page navigation.
  • External links: Navigate to external pages or Shopify admin pages from within your app.
  • Programmatic navigation: Navigate to routes using JavaScript with open() for cases where anchor elements aren't suitable.

App Bridge keeps the Shopify admin's address bar in sync with your app's route. When your app calls history.pushState() or history.replaceState(), App Bridge sends the new path to the admin, and the admin updates its address bar. Client-side routers such as React Router call these methods, so a redirect that your router follows after a form action also updates the address bar. When a new document loads in your app, App Bridge sends the URL of that document.

While a save bar shows, the admin doesn't apply your app's route changes. Your app shows the new page, but the address bar keeps the previous page, and a reload opens that previous page. Hide the save bar before your app navigates. For more information, refer to Navigation while the save bar shows.

Examples

html

<!-- Index pages -->
<a href="shopify://admin/products" target="_top">Products</a>
<a href="shopify://admin/orders" target="_top">Orders</a>
<a href="shopify://admin/customers" target="_top">Customers</a>

<!-- Specific resources -->
<a href="shopify://admin/products/123" target="_top">Product #123</a>
<a href="shopify://admin/orders/456" target="_top">Order #456</a>
<a href="shopify://admin/customers/789" target="_top">Customer #789</a>

Was this page helpful?