Phonegap code as a web app

后端 未结 3 1877
一生所求
一生所求 2021-02-03 16:03

I am thinking of re-using my phonegap html, css and js code as a web app. I would be going through and removing any mobile only functionalities.

The purpose is to have a

3条回答
  •  无人共我
    2021-02-03 16:06

    We are developing an iPad app and deployed it as a mobile website too. Whenever PhoneGap specific calls are made, using a common method called isRunningOnPhoneGap() (returns false if the code is running as website) , we decide whether to invoke the PhoneGap feature or to display the web feature. This is how we decide if the app is running as a website or on a mobile device.

    var isRunningOnPhoneGap: function () {
    
            if ((document.URL.indexOf('http://') === -1) && (document.URL.indexOf('https://') === -1)) {
                if (navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry)/)) {
                    return true;
                } else {
    
                    return false;
                }
            } else {
                return false;
            }
        }
    

提交回复
热议问题