Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript - Alert Message in iPad Application

Apologies for the rudimentary question, however the problem is I can't seem to find what one would think is a simple yes or no.

I have a backbone application that gets loaded into a webIUView (I believe is the proper terminology) within an iPad application.

I am simply attempting to do an alert within the application, testing on desktop (safari/chrome/etc) works as expected. However once I fire up the iPad application, my alerts aren't happening.

Investigation tells me phonegap has a notifier (http://docs.phonegap.com/en/1.0.0/phonegap_notification_notification.md.html) however I really don't want to use another framework just for an alert message.

I guess my first question is how come a simple alert doesn't work in iOS? Secondly, if it doesn't should I just do a simple dialog box that would mimic it?

Thanks in advance.

Edit: Code sample

I noticed this when implemented a network connection handler

    window.addEventListener("offline", function(e) {
        onNetworkChange(false);
    });
    window.addEventListener("online", function(e) {
        onNetworkChange(true);
    });

    function onNetworkChange(_isConnected){
        var msg;
        (_isConnected == false) ? msg = "Networking Connection Lost" : msg = "Network Connection Established";

        window.alert (msg);

    }

Because I wasn't sure if there was a problem with my code, in another view I decided to do a simple

    window.alert ('test');

And nothing, I must be either going crazy or overlooking something.

like image 201
Dave Collier Avatar asked Jun 06 '26 11:06

Dave Collier


1 Answers

I don't believe iOS Safari fires online and offline events. You can read more about iPad connection status event issues here:

http://ednortonengineeringsociety.blogspot.com/2010/10/detecting-offline-status-in-html-5.html

like image 131
AlienWebguy Avatar answered Jun 08 '26 23:06

AlienWebguy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!