Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6566913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:16:24+00:00 2026-05-25T14:16:24+00:00

The question might be slightly hard to understand, so I’ll explain it more verbosely:

  • 0

The question might be slightly hard to understand, so I’ll explain it more verbosely:

Say I have a mobile site on a website and the root of the site is http://www.site.com/mobile/

If I load up this page without any hashes in the URL, then I get one div with data-role=”page” in the DOM. If I then click a link to another page, which might take me to the URL http://www.site.com/mobile/#/mobile/contact.html, I get another data-role=”page” link for that page is inserted into the div. That’s all fine and correct.

However, if I then follow a link on this page back to the home page (but not the back button) and get the URL http://www.site.com/mobile/#/mobile/, then rather than jQuery Mobile reusing the same data-role=”page” div that was there when the page was first loaded, a new one is inserted into the DOM.

This has the effect that any JavaScript bound to the ‘pagecreate’ event that targets specific ids within the home page doesn’t work as the ids are ambiguous.

One thing I noticed when inspecting the generated HTML is that a data-role=”page” div loaded directly (not through a hash Ajax load) has a data-url attribute that is equal to the id of that div, but when it is loaded through a hash, then data-url is equal to the hash value. I wonder if this inconsistency is causing the issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:16:25+00:00Added an answer on May 25, 2026 at 2:16 pm

    jQuery Mobile uses data-url for internal linking. It will typically populate these itself and change target the data-role=”page” containers using the hash links. I suggest that any generated page have the data-url pre-populated by the server (i.e. do jQuery’s job for the first page that the user lands on – if they land on the homepage, populate the data-url field with the homepage information, etc).

    For example:

    <div data-role="page" id="home-page" data-url="<?php echo $_SERVER['REQUEST_URI'];?>">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question might not seem programming related at first, but let me explain. I'm
This question might be kind of elementary, but here goes: I have a SQL
This question might be naive as I'm new to ColdFusion programming. I have a
The question might not be clear, so i will explain further. I saw some
I believe this question might have been previously attempted in 2006 on a different
This question might look naive, but I couldn't understand this code in the ViewModelLocator.cs
This might seem a slightly subjective question however I am looking for what is
This question might be slightly subjective, but I am unsure where else it would
Similar question here but this is slightly different... I have two tables that I
This question might make one smile, really, HDD space is as cheap as dirt

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.