Best practice to share code across web application and mobile application with cordova -


i develop web application browser , mobile application cordova. want maintain 1 code base , have cordova references code web application. right have code web application in 1 folder , cordova project in folder.

cordova can use of code web application, need add code mobile specific behaviors not applicable desktop browser. in case, don't want add code web application.

so i'm seeking practice of sharing code among web application , mobile application (there's 1 problem that's not solved. cordova hardcode www , source web application in location). , i'm new cordova. i'm not better serve html, js, css files in mobile application. should pack of them app or load ones on demand when app running.

be aware if serving code remote server, connection server may go down @ time, such nature of mobile devices. if happens, may prevent navigation through application , cause user interface issues.

but if want serve cordova specific sections actual web application, use techniques from answer in order tell web application browsing cordova. use in conjunction server side scripting language such php selectively serve cordova specific sections.

for example, if serving page php script sets $cordova true if cordova detected, otherwise false, can this

<body> <a href="...">common section</a> <?php if($cordova == true): ?> cordova specific section <?php endif; ?> </body>


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -