2

I am developing a webapp mobile application. I am using jQuery mobile 1.9 + phonegap 2.4.

When I generate a page of HTML with listview, and the page is local on the web server or local in mobile, I can click in a listview item and I see back button, because I have defined data-add-back-btn="true" on all pages

But when I use an external link or if the local page is moved to a web server, when I click in item listview, I cannot see the back button and I can not go back.

Is this a bug in jQuery? How I can resolve this?

Simon Adcock
  • 3,554
  • 3
  • 25
  • 41
Roberto
  • 65
  • 8
  • No, it's not a bug. Because when you use `data-rel=external` for anchor, Ajax is disabled and page is loaded normally without the help of Ajax. Thus, browsing history built by Ajax is wiped. – Omar Jul 06 '13 at 21:01
  • I don't use data-rel=external. – Roberto Jul 06 '13 at 21:17
  • Are you using multi-page template or multi-files? – Omar Jul 06 '13 at 21:37
  • multi-files, all files add format jquery page with data-role="page" id="...", data-role="header", etc – Roberto Jul 06 '13 at 22:00
  • Check this http://stackoverflow.com/questions/11303489/jquery-mobile-back-button-does-not-work-with-cordova-1-9-0-and-android-2-2 – Omar Jul 06 '13 at 22:41
  • Thanks Omar, i am tried add data-rel="back" in orgin page, but if you but data-rel="back" when you click in link, your page go back history page. I want that this do it the target page. But if i add this link with button in target page, the button is show anytime , and i don't want this, i only what show , when i load this target page since app mobile, and not when someboby access surfing from web – Roberto Jul 07 '13 at 20:19
  • Sorry I didn't get you mean. What do you exactly want? – Omar Jul 07 '13 at 20:55
  • I want to do a listview with link a external web. I said, If I use a web local in phone or directory the link is right, but if i copy this web to a web server. The button back don't show it – Roberto Jul 11 '13 at 07:49
  • Put another way, i want do a listview with link to other domain web – Roberto Jul 11 '13 at 10:06
  • i think the problem is cross-domain – Roberto Jul 11 '13 at 18:52
  • please, somebody have some idea? – Roberto Jul 17 '13 at 09:36
  • Can add some code? like how you set `data-add-back-btn` to all pages, your listview links, etc... – Omar Jul 17 '13 at 09:47
  • Hi Omar The example code is this I create one listview with link to local page and all is right but if the link are the same page in external domain, don't show back button – Roberto Jul 17 '13 at 10:56
  • Pls update your question with that code. – Omar Jul 17 '13 at 11:10
  • for example one page target called page1.html is: – Roberto Jul 17 '13 at 16:54
  • if this page is in local domain , all right , but if this page is in other domain the button back don't show – Roberto Jul 17 '13 at 16:59
  • I think the problem is that when you load in local reference you call your web with protocol file:// but when you call a cross-domain must use http:// – Roberto Jul 17 '13 at 17:09
  • Maybe, have you tried it? – Omar Jul 17 '13 at 18:30
  • yes, but if you delete http in link jquery do error – Roberto Jul 17 '13 at 20:14
  • Why would you want to use domain, while all files/links are within one domain? – Omar Jul 17 '13 at 21:35
  • I access a external site, I need load the information of this webs. This information change all days – Roberto Jul 17 '13 at 21:43
  • I will try http://stackoverflow.com/questions/8847893/cross-domain-issue-with-jquery , surfing in stackoverflow i find more issues with the same problem with cross-domain – Roberto Jul 19 '13 at 12:09
  • I Omar thanks for your recomendation but i continue with the same problem. Is the last error i have for finish webapp. My code of this page is this http://pastebin.com/9nmAGagW – Roberto Oct 16 '13 at 08:13
  • try this code `$(document).on('click', '#forceBack', function () { $.mobile.changePage($.mobile.activePage.prev('[data-role=page]')); });` instead of `history.back()`. – Omar Oct 16 '13 at 08:23
  • The same, i have put the this code here: http://pastebin.com/TL13nr0U – Roberto Oct 16 '13 at 08:31
  • are you getting any error? is this the homepage? first page renders? – Omar Oct 16 '13 at 08:35
  • No,i haven't got errors, when i click listview, the hmtl change the new page and show it, Don't is posible and compatible with html5 standard show the new page in frame under? because i think in this standard for mobile devices are't available this option – Roberto Oct 16 '13 at 08:54
  • hombre! add `data-add-back-btn="true"` to `
    ` not content div.
    – Omar Oct 16 '13 at 09:00
  • This is right, but don't back , i have put
    but when i change other web it forget button back, i am testing in firefox/Internet explorer in PC.
    – Roberto Oct 16 '13 at 09:50
  • is posible open external page in dialog or frame ?? – Roberto Oct 17 '13 at 06:42
  • 3 months after trying, you can really make a lisview pages containing external and returning to lisview in a webapp? – Roberto Oct 20 '13 at 20:21
  • Lo siento, I'm still unable to understand the problem. What are you trying to achieve? What are you getting? – Omar Oct 20 '13 at 21:26
  • Si, un poco. No entiendo cual es el problema. – Omar Oct 20 '13 at 21:54
  • Te lo muestro en imágenes: Esto es la pantalla con el listview http://grab.by/rjFG al hacer click carga el contenido que es sacado de una web externa (todas son del mismo dominio externo) muestra esta pantalla http://grab.by/rjFQ, a partir de aquí no puedo volver atras(En iOS) y he perdido mi tabbar – Roberto Oct 20 '13 at 21:59
  • Mándame un mensaje por el email, omarmt arroba gmail com – Omar Oct 20 '13 at 22:15
  • is posible download external web in local ?, so i can use page in local domain. – Roberto Oct 22 '13 at 15:04
  • The solutions is installed plugin inAppBrowser and use window.open – Roberto Oct 24 '13 at 09:12

0 Answers0