This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

tab remembers url when refresh

more options

We have a single page application. And the url looks like below depending on the page that's clicked.

http://aaa.com/#/page1 or http://aaa.com/#/page2 or http://aaa.com/#/page3 .....

However, the tab doesn't reflect the current url . In fact, the tab shows a url that was at the moment I refresh the browser. For example, I was on http://aaa.com/#/page1 and hit F5 key. Then the tab keeps showing http://aaa.com/#/page1 even though I moved to http://aaa.com/#/page2.

Is this at all fixable?

Thanks, Joey

We have a single page application. And the url looks like below depending on the page that's clicked. http://aaa.com/#/page1 or http://aaa.com/#/page2 or http://aaa.com/#/page3 ..... However, the tab doesn't reflect the current url . In fact, the tab shows a url that was at the moment I refresh the browser. For example, I was on http://aaa.com/#/page1 and hit F5 key. Then the tab keeps showing http://aaa.com/#/page1 even though I moved to http://aaa.com/#/page2. Is this at all fixable? Thanks, Joey

Chosen solution

You can set document.title to modify the page title on the fly. This probably is a good idea in case the user is viewing the tab title on the Windows task bar jump list, where they will see much more of it:

document.title = "About Us :: Happy Applications";

You could create an array of titles (or partial titles) corresponding to the various hashes you are loading to streamline it.

Ler a resposta no contexto 👍 0

All Replies (8)

more options

I'm not sure I understand your scenario. Is the problem that the new URL is not appearing in the address bar when it should, so Firefox reloads the wrong URL, or that the URL reverts to an earlier page when you reload??

jscher2000 - Support Volunteer modificouno o

more options

Actually, on second read, it seems that the application works normally unless you reload the page. After a reload, the URL bar is stuck and the hash does not get updated.

What is your code to update the hash in the URL bar? When that code runs, do any errors appear in the browser console (Ctrl+Shift+j)?

more options

Thanks for your reply. The address bar has no problem. Even after a reload, the application works fine. But the TAB (not the url bar) shows the wrong/old url instead of the current url in the address bar.

When I said tab, i meant the tab of the browser.

more options

This doesn't happen on Chrome just fyi

more options

Also, it doesn't have to do with the code because the tab shows the old url even if I manually type in a new url in the address bar and hit enter.

For example, I am on http://aaa.com/#/page1 And I refresh the browser (at this point, the browser tab reflects http://aaa.com/#/page1) And I type in http://aaa.com/#/page2 in the address bar and hit enter. At this point, the tab still shows http://aaa.com/#/page1 (the address bar has the correct url which is what i typed in which is http://aaa.com/#/page2)

joeykimcaissa modificouno o

more options

Is this page online for viewing by forum volunteers?

I'm not clear on what you mean by the tab.

You could be saying that the tab content is not scrolled to the expected location within the page when you change the address in the URL bar, or the script that should run when the URL is changed is not running.

Or you could be saying that the text on the little tab itself -- normally the window title, absent which the URL is displayed -- isn't updating.

I'm doing a lot of guessing here, so it would be helpful to be able to see the problem first-hand.

If your page is not online but you see the problem in similar applications on other sites, you could link to one of those instead.

more options

Thanks for your reply. This application is not online but the problem is, as you described, the text itself on the little tab isn't updating.

SO, the actual text on the little tab shows http://aaa.com/#/page1 when I am actually on http://aaa.com/#/page2.

However, I think I should just be able to give a certain name on the little tab instead of trying to reflect the current url. Just like this support forum page's tab is showing "tab remembers url when....." instead of the url.

So, this is my new question... How can I name a tab in the code?

more options

Chosen Solution

You can set document.title to modify the page title on the fly. This probably is a good idea in case the user is viewing the tab title on the Windows task bar jump list, where they will see much more of it:

document.title = "About Us :: Happy Applications";

You could create an array of titles (or partial titles) corresponding to the various hashes you are loading to streamline it.