I'm a front-end developer and currently working on a wordpress site. The site have a Tabbed section on one of the page, clicking on any tab load the relevant div (as expected). What I want is, when any Tab is clicked/selected, it's name should show up in the browser's URL bar. Please guide me in this, thanks.

  • M. Jawaid
  • That’s not what the address bar is for. The address bar shows the URL. What would changing it to something else achieve? – Jacob Peattie Oct 31 '17 at 13:22
  • It's needed for SEO purposes, just to show the selected menu name. – Motasim Oct 31 '17 at 13:25
  • A search engine isn’t going to pick up on it. I don’t understand why this is necessary. I’ve never even see it before. You know when you add a page in WordPress then the page name is part of the URL already, right? – Jacob Peattie Oct 31 '17 at 13:50
  • @JacobPeattie Yes, the page name is part of the URL, but I don't need the page name, I need the selected Tab name on any page to show up with the URL. – Motasim Oct 31 '17 at 14:00
  • 1
    Sorry but Why?. You mentioned SEO, but Google's bots don't have an address bar, so they're not gonna care what you do to it. And as a user I'd be so annoyed if this happened. It's essentially breaking the browser for no reason. You're not talking about the title bar or the browser tabs are you? – Jacob Peattie Oct 31 '17 at 14:45

This is not something I would suggest and not sure why you want that. But using hashes you can do

    $('#action_tab').click(function () {
      window.location.hash = 'xyz';
      return false;
  • Thanks, It's for marketing purposes, let me try this solution. – Motasim Oct 31 '17 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.