Question

I have an ASP.NET MVC 3 app that I have built as a single page app that following the example(s) in the BigShelf SPA using Knockout.js and History.js to handle user interaction and navigation. Everything works fine, but I'm noticing a weird quirk with the title being displayed in the browser tab:

  1. When the app loads, the browser tab title properly displays the content of the <title> tag, i.e., My Single Page App
  2. When History.js uses either pushState or hashChange (depending on the capability of the browser) to modify the URL, the browser's tab title is set to the newly modified URL, i.e., the browser tab now reads http://www.mysinglepageapp.com/modified/url

Again, functionally there's no problem, but it's odd to me that the tab title is also modified. This is happening in all browsers that I've tested (IE6+, FF, Chrome, Safari).

Is their anyway to change or control this behavior?

Was it helpful?

Solution

Going off of Bergi's comment, I took a closer look at History.js and the wrapper provided in the BigShelf SPA example.

Turns out that History.js provides a method that accepts a parameter of which title should be displayed history.pushState(params, title, url). The wrapper in the SPA passes the url as the title. I changed that to the name of my app and that solved the "issue".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top