This is truly odd. I've got an index.html file that uses a pageshow event to register a button handler:
console.log("pageshow for mainPage");
This is used to handle login logic. When I run my app, this works perfectly one time. I only return to this page when I logout. I can confirm that when I return that the pageshow log shows up. But the submit button handler isn't registered. I can even do
just to confirm it is still in the DOM, and it definitely is. But it is like the one() refuses to register the event. Btw, I tried one() because I thought maybe my on() was registering the event twice.
I've got what I think is a simple requirement. The first page of my JQM app is a login page. The second, and so on, are my 'real' pages. I'm trying to prevent the user from hitting the Back button so much they end up on the login page.
According to the docs, pagebeforechange can be used to prevent navigation to another page. I've been able to confirm this. No big surprise there. But when I prevent the navigation, the URL in the browser still changes. Hitting back again performs another back and the user is sent to the initial page.
Click to load page 2. Click back. Notice you DON'T go back visually, but the URL changes. Click back again and you are out of the site. Just view source on index.html for the code I'm using - you can see it at the bottom.
I've got a JQM page that does an Ajax call to get a list of classes. I take that data and render a dynamic list. Each LI links to
where X is a unique ID. The pageshow handler that page parses window.location.search (the query string). This works on the desktop. It works in PhoneGap on the Android emulator. But it fails on a real device (again, wrapped in PhoneGap). Any ideas?
as a way to configure the text for the close button. But dialogs do not have text on the close button, instead it simply has a "X" icon you can click to close it. Now that does have a tooltip which says close, but as that is useless on a mobile device, what exactly is this feature used for?
The page linked with this code uses a back button in the header so folks can leave the page. But, when they go to other pages, they can't use the back button. So I figured - just listen for the pageremove event and remove the event listener.
In earlier builds of JQM, my site would have an index.html page that included jQuery+JQM. When I linked to other pages, I could simply use the div page wrapper and be done with it. Since the URL always included index.html, if you book marked so sub page, you still got a proper display.
Now that pushState is used to update the URL in the browser. I found that if I went to some sub page, bookmarked the url, and returned, I'd get an unstyled display. That kinda makes sense - but I'm wondering now if the "best practice" is to always include the full header? Actually I'm not sure I'd call it a "best practice" - it would be required.
I could probably test this quicker than I can write the question, but if page A has a link to page B and uses data-prefetch, and page B has N more links like that, will they also be prefetched? Or are they only loaded when B itself is actually rendered. I'm assuming so - but I want to be sure.
So, I've got an interesting problem. I want to manipulate a list on a page every time the page loads. If I use pageShow as my event listener, it's run BEFORE the page's controls are initialized and therefore will throw an error if I do something like listview('refresh'). If I use pageCreate, it works perfectly. But that's only run once.
So what's the best way then to handle updating controls every time the page is viewed, bur AFTER the initial creation?
I've noticed that a form within a page loaded as a dialog seems to reload the animation. What I mean is - I get an ajax post, as expected, but it's like the dialog goes away and re-appears. Is there a way to disable that? I know I could simply write my own code to handle my form post, but I'm hoping there is a simple solution.
If you search for "e" you will get a lot of results. The Prev/Next buttons work fine, but what I'm playing around with is swipe left and right events. I thought it might be cool if you could paginate using swipe events. In my index2.cfm file I added the following simple code:
As you can see, I'm just logging now, not actually moving the user yet. Anyway, what's weird is that the URLs I'm picking up are being cached. If I swipe right I see the proper next url. But if I click the button to go to the next page and swipe right again, I'm seeing the same URL.
This worked fine. So I then added a button so I could test a swipe event over it. Unfortunately, the second I added the button (even with the event handler comment out), my tap events completely stopped working.
I've noticed that when doing a simple form post on a page that uses a "large" select (ie, a select that loads a new page to let you pick the item) that my form posts no longer work. I end up with a 404 error instead. This only happens if I make use of the large select. If I leave it alone I can post the form just fine.