Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation through browser history by hash not working #60

Open
herrschuessler opened this issue May 18, 2015 · 4 comments
Open

Navigation through browser history by hash not working #60

herrschuessler opened this issue May 18, 2015 · 4 comments
Labels

Comments

@herrschuessler
Copy link
Contributor

Setting the option setHash to true adds a unique URL hash each time a tab is opened - great feature. Opening a URL with hash via link or typeing in the adress bar opens the corresponding tab - just as expected and advertised.

Navigating through the browser history via the browser's back / forward buttons however does not open the corresponding tabs, instead nothing happens, the last opened tab stays open.

@herrschuessler
Copy link
Contributor Author

Edit: I see that navigation by browser history is implemented in the _loadEvents function, but it's unreliable in both FF and Chrome / OS X. Sometimes the value _ignoreHashChange (set in line 234) is set to true on the the tabs, preventing them from being opened by navigation through browser history. Howerver, setting _ignoreHashChange seems to fail randomly in the mentioned browsers.

What purpose does _ignoreHashChange serve?

@jellekralt
Copy link
Owner

Sorry for the late response. The _ignoreHashChange boolean was built in to prevent an infinite hash change loop. The plugin listens for the hash change event to check if it should activate a tab, but when activating a tab, the hash gets updated. Without the _ignoreHashChange boolean the hashchange event would again be triggered and the tab would again be activated, and so on.

That being said, if this is causing issues with the browser history, it will need to be fixed. I'll try to investigate why this is happening, I don't know when i'll have time though. If you find the problem i'd be happy to accept a PR for the solution :)

@jellekralt jellekralt added the bug label Aug 6, 2015
@daminloi
Copy link

daminloi commented Apr 7, 2016

Is there anything scheduled in the pipeline for this? This would be a nice to have feature sorted out.

@tomschulze
Copy link

i actually wanted to provide a fix. in order to understand what caused the infinite hash change loop i commented the line e.data.tab._ignoreHashChange = true;. however, to my surprise, switching between the tabs worked fine and an external link containing a tabref as hash worked also fine. browser history worked accordingly.

tabsContainer.responsiveTabs({
            active: 0,
            load: function(event, firstTab) {
                tabsContainer.css('opacity', '1');
            },
            setHash: true
        });

i tested in

  • IE11
  • Edge 42
  • Chrome Version 74.0.3729.6 (Official Build) dev (64-bit)
  • Firefox 65.0.2 (64-bit)
  • Firefox Developer 73.0b2 (64-bit)

maybe this was an upstream bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants