I have a Phonegap and jQuery Mobile app that works great on Android and the web. On iOS, I get unexpected results, which are apparently caused by the fact that the document.pageinit event, to which I attach a handler for most application processes, fires twice.
No, I did not bind it twice. No, I did not use document.ready. Yes, I bound it to the document early in the script, and not inside any other function.
$(document).on('pageinit',function(event){ alert(' Pageinit on document');
At the first start, the splash screen is still displayed. At the moment, when testing a MacBook Pro with Xcode, the console is not even available: the above message did not appear in the console when I used console.log.
The second time, fires shortly after jQueryMobile created the first page.
What causes this double layoff and what can I do with it?
EDIT: I later noticed that pageinit does not just start a second time, but every time I open a new data-role = 'page' div section. See my answer below.
Wytze source share