1

Basically I want to "outsource" some of the content pages into single .html files. The pages are located at the same server and should be loaded normally by a link:

   <li><a href="#/link1.html" class="contentLink">Link1<span class="icon"></span></a></li>

The content of the link1.html page:

<!-- page -->
<div data-role="page" class="pages" id="link1">
  <!-- header -->
  <div data-role="header"> <a href="#" onClick="" class="showMenu menuBtn">Menu</a>
    <div class="headerlogo"></div>
  </div>
  <!-- /header -->
  <div data-role="headerimage" class="headerimage"><img     src="images/headerimages/bild1.jpg" /></div>
  <div data-role="content">
    <h3>Link1</h3>
    <p></p>    
  </div>
  <!-- /content -->
</div>
<!-- /page -->

When I am clicking on the link in the menu, the content is shown fine. But the URL is changed in a way that may cause troubles.

What I want is: http://example.com/#link1.html

But what I get is: http://example.com/link1.html

So the problem is, that if someone tries to reload the page http://example.com/link1.html, he/she only gets the content of link1.html without all js/css things.

What I am doing wrong?

Thx Stefan

1 Answer 1

2

You'll need to include the jquery mobile code in the head of link1.html and every other external file if you're going to take this approach.

Edit - This may actually achieve what you're trying to do.

$(document).on('mobileinit', function () {
    $.mobile.pushStateEnabled = false;
});

Make sure the event handler is placed before jQuery Mobile is loaded.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi! Thank you for your answer. Would be nice and clean if I could do this without having these files included in the head. Is there no chance to tell jQuery mobile not to remove the hash (#) ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.