Skip to content
This repository

data-title bug #4998

Closed
ghost opened this Issue · 3 comments

2 participants

Jasper de Groot Rob Schmuecker
Deleted user

I have multiple pages each one with a "data-title" attribute.

It doesn't work if you enter one of these pages and then refresh the browser.

Then the initial title will be the one in the "title" element.

Jasper de Groot
Collaborator

@wingy

Please provide all required information and a test page. See https://github.com/jquery/jquery-mobile#issues

Rob Schmuecker

Here is a test page http://jsbin.com/uvatok/3

Whilst I think this is strongly related to #2865 and #3292 it doesn't seem as though there is a definitive implementation of the correct consensus.

The above JSBin shows that the Original document title is only displayed IF

  1. The page is initially loaded and has not been reloaded by navigating to the page as opposed to data-rel="back"
  2. Any of the internal links has been navigated to directly by the browser as opposed to "linked" by the framework.
  3. The user refreshes whilst the URL is pointing to a secondary/deep-linked page. i.e. http://jsbin.com/uvatok/3#page2

What it doesn't show but is the indicated behaviour is that if the "External Page" didn't have a data-title attribute it would use that document's <title>

I guess the issue here is the consistency - perhaps we should just run a check on the pageinit and reforce the title to be the value of data-title attribute or if not present fallback to either document title or blank/default browser behaviour.
Alternatively there are times when one may want an arbitrary title across all pages so perhaps there's scope for a global value which would override any above-mentioned behaviours or at the least ignore <title> tags and perhaps only gets overridden if an explicit data-title attribute exists on a data-role="page" element.

R.

Jasper de Groot
Collaborator

@robschmuecker - Thanks for your very useful comment!

@wingy - I changed the title of #2865 and close this ticket (and #3292) as duplicate. This way we have one ticket about the page title / data-title logic including links to related commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.