Ali Khatami
Ali Khatami

Reputation: 379

How to make server pages interact with cordova

I'm developing a mobile application using cordova 6.0 . At the first page of it (/www/index.html) there is a redirection to the first page of my web application.

On the server I'm using oracle application express so that I can develop my mobile application very easy, but the point is I don't have cordova on the server and I can't use mobile native features like camera.

What are the necessary files that I need to upload to my server, or other things to do to make my web application server interact with cordova and get access to mobile native features ?

here is actually what I want to do in the first page of application :

<!DOCTYPE HTML>
    <html>
    <head>
    <title>My app</title>
    <script charset="utf-8" type="text/javascript" src="cordova-2.1.0.js"></script>
    <script type="text/javascript">
    // Wait for Cordova to load
    //
    document.addEventListener("deviceready", onDeviceReady, false);
    // Cordova is ready
    //
    function onDeviceReady() {
    // Empty
    }
    function listener(event) {
    if (event.origin !== "http://apex.oracle.com") return;
    if (event.data == "vibrate") {
    navigator.notification.vibrate(2000);
    }
    }
    if (window.addEventListener) {
    addEventListener("message", listener, false);
    } else {
    attachEvent("onmessage", listener);
    }
    </script>
    <style type='text/css'>
    body,html,iframe {
    margin: 0; padding: 0; border: none; width: 100%; height: 100%;
    }
    </style>
    </head>
    <body>
    <iframe src='http://apex.oracle.com/pls/apex/f?p=41097:2' id='iframe'></iframe>
    </body>
    </html>

Upvotes: 1

Views: 693

Answers (1)

Hardik Vaghani
Hardik Vaghani

Reputation: 2173

Actually you are trying to load pages from server and make them interact with native feature like phonegap does, but problem arise when you are trying to integrate phonegap framework to server pages. Simply you can not do that because even if you will include cordova.js it will not be able to interact with native files that are vital for native feature.

Upvotes: 1

Related Questions