Michael Unterthurner
Michael Unterthurner

Reputation: 941

jquery mobile data-rel= back troubles

My problem is that im usign JQM and I have a back button on each site.

<a data-rel="back" data-role="button" data-inline="true" data-icon="arrow-l" data-transition="slide" data-direction="reverse" data-iconpos="notext"></a>

At several pages it goes back and at other pages I can't go back with the button. It shows me always that error in the console (it is a jquery mobile error). I'm googleing since a hour or 2 and I have only founded, that this bug was a chrome bug and it is closed.. (chromium)

Uncaught TypeError: Cannot call method 'indexOf' of undefined

Upvotes: 2

Views: 4273

Answers (3)

Michael Unterthurner
Michael Unterthurner

Reputation: 941

That is working:

<a data-role="button" data-inline="true" data-icon="arrow-l" data-transition="slide" data-direction="reverse" data-iconpos="notext" onclick="history.go(-1);"></a>

Upvotes: 1

yeyene
yeyene

Reputation: 7380

Or, you can use desired page id as href in a tag. (if you are navigating with page id's)

href="#your_pageID" will be the page id you want to go back.

<a href="#your_pageID" data-role="button" data-theme="b" data-icon="arrow-l" data-iconpos="notext" data-transition="slide" data-direction="reverse" data-iconshadow="false" data-inline="true">
    Back
</a>

Upvotes: 1

RONE
RONE

Reputation: 5485

as you said in some pages it is going back and in some pages it is showing errors. It may be because, the pages which it is redirecting properly may not have any jquery code. And the others which you have errors may have jquery code, and before redirecting it is calling the function.

Try This:

The pages which has errors, may have dependence on external .js files, related to it. So copy the set of files, which you may have pasted in the main layout file. and try.

Upvotes: 0

Related Questions