Webflow sync, pageviews & more.
NEW

How can I create separate URL links for each tab in Webflow?

TL;DR
  • Assign unique IDs to each tab pane and tab link in Webflow to match URL hashes (e.g., #tab-1).
  • Add a custom JavaScript snippet that auto-selects the correct tab on page load based on the URL hash and updates the hash when a tab is clicked.

To create separate URL links for each tab in Webflow, you’ll need to manually implement tab state recognition via URL hash links because native Webflow tabs don’t change the URL by default.

  • Webflow assigns each tab pane a unique ID like tab-pane-1, tab-pane-2, etc.
  • You can create direct links like https://yoursite.com/#tab-1, #tab-2, etc., where each hash corresponds to a specific tab.
  • In the Webflow Designer, select each Tab Link, go to the Element Settings, and assign a unique custom attribute (id) like tab-1, tab-2, etc.

2. Add Unique IDs to Each Tab Pane

  • Go to each Tab Pane and set a unique ID in the Element Settings panel.
  • For example: products-tab, features-tab, pricing-tab—these will correspond with the tab hash links.

3. Add Custom JavaScript to Switch Tabs Based on URL Hash

Since Webflow doesn't automatically switch tabs based on the URL hash, insert a small custom script in the page footer:

  • Open Page Settings
  • Scroll to Before tag
  • Add JS that reads the hash and activates the correct tab when the page loads.

Sample logic you can use (avoid raw code blocks, summarized here):
Use a script that checks window.location.hash, finds the tab link with a matching href, and triggers a .click() on it.

  • Anywhere in your site, set links to yourpage.com#tab-2.
  • When the linked page loads, the script will auto-open the corresponding tab.

5. Update Tab Clicks to Modify URL

  • In the same script, also capture tab clicks and update window.location.hash using history.replaceState() or location.hash to reflect the selected tab.

Summary

To create separate links for each tab, assign unique IDs to tab panes and use URL hashes to reference them. Then, use a lightweight custom script to make the correct tab open based on the hash. This approach makes each tab directly linkable via a unique URL.

Rate this answer

Other Webflow Questions