Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Ajax Mode Erratic or Not Working #4867

Closed
cawoodm opened this issue Aug 20, 2012 · 12 comments
Closed

Ajax Mode Erratic or Not Working #4867

cawoodm opened this issue Aug 20, 2012 · 12 comments

Comments

@cawoodm
Copy link

cawoodm commented Aug 20, 2012

I've described the problem here:
http://stackoverflow.com/questions/12004729/erratic-ajaxing-with-jquerymobile

However it's not so erratic as it once was. At the moment AJAX seems only to be working in IE9. Not in Chrome 20 and not on the iPhone Safari (3Gs with iOS 5.1.1).

Example of what happens when I click:

Chrome & iPhone (not ajaxing)
http://jquerymobile.com/demos/1.2.0-pre/docs/pages/index.html
http://jquerymobile.com/demos/1.2.0-pre/docs/pages/page-anatomy.html

IE (ajaxing)
http://jquerymobile.com/demos/1.2.0-pre/docs/pages/index.html
http://jquerymobile.com/demos/1.2.0-pre/docs/pages/index.html#/demos/1.2.0-pre/docs/pages/page-anatomy.html

The behaviour is the same for 1.0 and 1.1.1.

@frequent
Copy link
Contributor

@cawoodm: Do you have some more info, when AJAX is not working.

I'm only having problems when I'm loading an app in fullscreen mode ( = apple-mobile-web-app-capable ), but in case you are using a cache manifest, there are plenty of workarounds ( [here](add network resources](https://forum.jquery.com/topic/ajax-fail-in-mobile-app) or [here](set isLocal]%28#1194). Maybe one of these can help.

@serbanghita
Copy link

@frequent This is interesting, cannot click the workaround links, pls fix. Thanks!

@cawoodm
Copy link
Author

cawoodm commented Aug 21, 2012

@frequent It's really independent of my application. When I surf the official JQM docs links (above) with Chrome 20, an iPhone or an iPad 2 it does no AJAX.

Click here for example in Chrome:
http://jquerymobile.com/test/docs/pages/page-anatomy.html
When you then click "Single page template" do you land here:
a) http://jquerymobile.com/test/docs/pages/page-template.html
OR here
b) http://jquerymobile.com/test/docs/pages/page-anatomy.html#/test/docs/pages/page-template.html

I always land at a (no ajax) except int IE9 where I land at b (ajax).

@cawoodm
Copy link
Author

cawoodm commented Aug 21, 2012

Just to be clear, my links are normal (local) HTML links without hashes or rel attributes:
<li><a href="./default.htm?n=1234">Hello</a></li>

@serbanghita
Copy link

@cawoodm wait a sec, in http://jquerymobile.com/test/docs/pages/page-anatomy.html the link 'Single page template' has 'data-ajax="false"' so it will not load through AJAX. Are you saying that there is an exception on IE9?

@cawoodm
Copy link
Author

cawoodm commented Aug 22, 2012

@serbanghita Sorry, unlucky example. Take for example the page "Page titles". In Chrome (& FF & Safari) I click it and get:
http://jquerymobile.com/test/docs/pages/page-titles.html

In IE:
http://jquerymobile.com/test/docs/pages/page-anatomy.html#/test/docs/pages/page-titles.html

Am I really the only one seeing this behaviour?

@serbanghita
Copy link

@cawoodm I tried to go from http://jquerymobile.com/test/docs/pages/page-anatomy.html to 'Page titles' with iPad 2 (iOS 5), Chrome 21.0.x, IE9 and IE8 and the URL successfully changed to http://jquerymobile.com/test/docs/pages/page-titles.html

I checked in Chrome with the Inspector (F12) -> Network tab -> XHR and saw the AJAX request.

@cawoodm
Copy link
Author

cawoodm commented Aug 22, 2012

the URL successfully changed to http://jquerymobile.com/test/docs/pages/page-titles.html

erm, that's exactly the problem. Why isn't it changing to http://jquerymobile.com/test/docs/pages/page-anatomy.html#/test/docs/pages/page-titles.html ??

It's refreshing the entire page instead of ajaxing. If I debug I also see the ajax request but an ajax request should not change the URL but only the hash! The whole point of JQM is that it fetches pages via AJAX and inserts the content in the current page.

@cawoodm
Copy link
Author

cawoodm commented Aug 29, 2012

Bump.

I really need to get to grips with this issue: JQM is really ugly on an iPhone if the page refreshes all the time.

@johnbender : surely you can quickly see what I am missing here?

@jaspermdegroot
Copy link
Contributor

@cawoodm

See section "pushState plugin" here http://jquerymobile.com/test/docs/pages/page-navmodel.html
Closing as solved, but please comment if you think it's still an issue.

@cawoodm
Copy link
Author

cawoodm commented Aug 29, 2012

OK that solved it my side.

I still don't get it though and it looks like a backwards step. PushState looks, for all intents an purposes, to the user like rel="external". On the iPhone you get the address bar popping down and a short white screen with each navigation click...

@frequent
Copy link
Contributor

@uGoMobi

It would be nice to add some info in the docs pushstate section, showing an example of what URLs with and without pushState look like. It took me so forever to realize that:

 http://www.somepage.com/folder/index.html  >  going to page2.html

is acutally:

 http://www.somepage.com/folder/index.html/#folder/page2.html

while pushState shows:

 http://www.somepage.com/folder/page2.html

Yes, it's in the text description that pushstate replaces the url, but I didn't realize how it actually works (and why my parseUrl always returned "strange" results.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants