0

Using jQuery Mobile with ThemeRoller theme, the accordion menu delivers a URL with hash when "Cake Sizes" is clicked. The ThemeRoller theme does not load with has in URL.

<div><h3><a href="#">Cakes</a></h3>
<div id="accordion-child">
<div><h3><a href="/cakes/cake-sizes" data-transition="slideup">Cake Sizes</a></h3></div>
<div><h3><a href="/cakes/flavors">Flavors</a></h3></div>
<div><h3><a href="/cakes/gallery">Gallery</a></h3></div>
</div>
</div>

When click "Cake Sizes" URL is http://example.com/#/cakes/cake-sizes

How do I prevent # from ending up in URL or how do I remove it? Does anyone know why Themeroller theme will not load with hash in URL?

Cœur
  • 37,241
  • 25
  • 195
  • 267
sandraqu
  • 1,428
  • 1
  • 14
  • 31

2 Answers2

0

Why do you have the # in the href for cakes anyway. Leave it blank and it will behave in the same manner.

Anirudh Ramanathan
  • 46,179
  • 22
  • 132
  • 191
  • Good suggestion. I tried that and it does not work. Somehow the hash is added. The status bar says mydomain.com/cakes/cake-sizes, but when i click and the page loads the URL has the hash in it: mydomain.com/#/cakes/cake-sizes. I think only my custom css is actually working and none of the other css. – sandraqu Jun 10 '11 at 13:42
  • It seems to work for me... I believe the # is coming from someplace else for you... – Anirudh Ramanathan Jun 10 '11 at 14:13
  • Could you send me your code? I wonder if it's my jquery script call. – sandraqu Jun 14 '11 at 14:51
  • I was testing with a browser. The JQM Controls do not load in a browser (it not being a handheld device) and this created the "error". You have to tell the browser to pretend to be a handheld device. – sandraqu Jun 17 '11 at 14:12
0

By default jquery mobile using ajax calls to load pages. So the "#" included automatically in the url. To avoid that,use

data-ajax="false"

to disable ajax call on the hyperlinks. And try like this

<div><h3><a href="#" data-ajax="false">Cakes</a></h3>

Hope it works...

Ra.
  • 935
  • 4
  • 18
  • 30