As we all know, the website is based on the browser running environment, and the mobile browser is using the WebKit kernel, directly convert the website into APP, may not be suitable for mobile phone, adaptation will also have problems, if the developer in the development process at the same time adaptation of mobile can be avoided; However, there is another problem. The functions in the browser are not fully supported on the mobile phone, so you need to use the corresponding functions provided by the mobile phone.

The function of mobile phone can be realized by using the plug-in of mobile phone, for example: to call the function of taking pictures, you can use the Camera plug-in. The use of the plug-in is very simple, just select the corresponding plug-in to add on the app that has been created. In the front-end project of the WEBSITE, introduce:

<! <script type="text/javascript" SRC ="supconit://hcmobile.js"></script>Copy the code

Then write the API that calls the plug-in in the front-end project:

navigator.camera.takePhoto(function(success) {
        alert(JSON.stringify(success));
        },
        function(error) {
        alert(JSON.stringify(error));
        },true,1024);
Copy the code

In this way, the mobile phone can realize the function of taking photos, which perfectly solves the problem that the website can be turned into part of the APP. In order to improve the integrity of your APP, it is necessary to use plug-ins correctly.

If you have any questions, please correct them