android - Uncaught TypeError: Object #<Object> has no method 'exec' at file:///android_asset/www/js/webSocket.js:51 -
i using websocket programming here.https://github.com/knowledgecode/websocket-for-android.but after following steps getting error.i using cordova 2.7 .can please tell me how sove prolem
uncaught typeerror: object #<object> has no method 'exec' @ file:///android_asset/www/js/websocket.js:51
here html file..
<html> <head> <meta charset="utf-8" /> <meta name="format-detection" content="telephone=no" /> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /> <link rel="stylesheet" type="text/css" href="css/index.css" /> <title>hello world</title> </head> <body> <div class="app"> <h1>apache cordova</h1> <div id="deviceready" class="blink"> <p class="event listening">connecting device</p> <p class="event received">device ready</p> </div> </div> <script type="text/javascript" src="cordova.js"></script> <!--script type="text/javascript" src="js/websocket.min.js"></script--> <script type="text/javascript" src="js/websocket.js"></script> <script type="text/javascript" src="js/index.js"></script> <script type="text/javascript"> var ws = new plugins.websocket('ws://192.168.1.102/8101'); // onopen callback ws.onopen = function () { console.log('onopen'); this.send('hello'); }; // onmessage callback ws.onmessage = function (data) { // data received text console.log(data); // hello this.close(); }; // onerror callback ws.onerror = function (message) { // message reason of error console.log(message); }; // onclose callback ws.onclose = function (code) { // code reason code of disconnection console.log(code); // 1000 }; // app.initialize(); </script> </body> </html>
one possibility 1 of libraries (cordova.js, websocket.js) extending object.prototype, , other using objects hash tables without checking hasownproperty(). if that's case, you'll need find replacement 1 of libraries or roll own. see related question.
Comments
Post a Comment