Search code examples
javascriptiosjquery-mobile

JQuery Mobile 1.4.5 does not seem to invoke javascript on ipad


Using JQuery mobile 1.4.5 (https://jquerymobile.com/)

Ironically, everything works on desktop browsers, but I cannot seem to get anything to work when testing on an iPad ...

My stripped down page (HTML) contains the following:

<div data-role="content">
 <script src="test.js"></script>    
 <script>
  $( document ).on( 'pagecreate', function( event ) { do_something(); });
 </script>
</div>

The file "test.js", contains the following code:

function do_something() {

   alert('here in do_something()');

}

When testing on an iPad, all I get is a grey circle with a "spinning comet" rotating around in the circle and the page never even renders (Yes, I tried rebooting the iPad, clearing browser history/data, etc).

On all other browsers, I get the alert.

Ultimately, I am trying to load google maps into the page along with the javascript I need to manipulate various DOM elements as well as manipulate the map -- which I CAN do and is working on all other browsers -- just can't seem to get anything to work when testing on an iPad (I do not know how to view source or console messages via iPad Safari, which makes debugging a nightmare).

ANY suggestions would be helpful.

Thanks in advance.


Solution

  • Thanks to all who provided some insight...

    Turned out it was an external javascript file that contained a try/catch block as:

    try {
       // code
    }
    catch {
       // code
    }
    

    When changed to:

    try {
       // code
    }
    catch(err) {
       // code
    }
    

    ... after the change was made, all tests passed !!