You can use the "hash". This is the part of the URL that follows the "#" character.
If you only need to respond to the hash at the time the page loads in order to support the bookmarks feature, you can get away with something like:
Ext.onReady(function() { var tabPanel = new Ext.TabPanel({ // Configure for use in viewport as needed. listeners: { tabchange: function( tabPanel, tab ) { window.location.hash = '#'+ tab.itemId; } } }); var token = window.location.hash.substr(1); if ( token ) { var tab = tabPanel.get(token); if ( ! tab ) { // Create tab or error as necessary. tab = new Ext.Panel({ itemId: token, title: 'Tab: '+ token }); tabPanel.add(tab); } tabPanel.setActiveTab(tab); } });
You can also go further and use the hashchange event, which is supported in the latest versions of most browsers. This will allow you to respond to a hash that changes by the user or software after the page has finished loading:
if ( 'onhashchange' in window ) { window.onhashchange = function() { var token = window.location.hash.substr(1);
It's worth noting that Ext.History singleton promises functionality is similar to this. However, as with ExtJS 3.3.1, it did not receive support for the hashchange event and, instead, is completely dependent on the polling interval and the hidden iframe hack. I was not comfortable with its performance in modern browsers - in particular IE - until I rewrote it to use hashchange where possible.
source share