The Jquery Mobile Multiple titles problem

    What is this "Multiple Title" problem? In JQuery Mobile, we have the multi-page structure which causes this problem. In case you want to check out what multi-page structure in Jquery Mobile is, please check out this post.

The problem:
    When you load the first page of a jQuery Mobile based site, then click a link or submit a form, Ajax is used to pull in the content of the requested page. Having both pages in the DOM is essential to enable the animated page transitions, but one downside of this approach is that the page title is always that of the first page, not the subsequent page you're viewing.

The solution:
    jQuery Mobile automatically parses the title of the page pulled via Ajax and changes thetitle attribute of the parent document to match. For the multi-page documents, we handle this using the data-title attribute which is added to each page container within a multi-page template to manually define a title. The title of the HTML document will be automatically updated to match the data-title of the page currently in view. So your div with data-role="page" would look something as seen below.

<div data-role="page" id="page1" data-title="Page Title">

    Hope you have followed the post and your title is solved. Do let me know in case you have any issues and I will try to help you with those.

Popular posts from this blog

Where does Google get it's live traffic data from?

jQuery Mobile's Next Big Step

Geodesic Polyline