ionic framework - how to use cordova inappbrowser plugin -
i developing mobile app apache cordova. simple app loads responsive website. now, using html tag load page, want use cordova inappbrower purpose.
this www/index.html file:
<!doctype html> <html> <head> <title>title</title> </head> <body style="width: 100%;height: 100%;overflow: hidden;"> <iframe style="width: 100%;height: 100%; border: none;" height="100%" src="http://www.mywebsite.com/"></iframe> <script type="text/javascript" src="cordova.js"></script> <script type="text/javascript" src="js/index.js"></script> </body> </html>
this www/js/index.js file:
var app = { initialize: function() { document.addeventlistener('deviceready', this.ondeviceready.bind(this), false); }, ondeviceready: function() { var networkstate = navigator.network.connection.type; var states = {}; states[connection.unknown] = 'unknown connection'; states[connection.ethernet] = 'ethernet connection'; states[connection.wifi] = 'wifi connection'; states[connection.cell_2g] = 'cell 2g connection'; states[connection.cell_3g] = 'cell 3g connection'; states[connection.cell_4g] = 'cell 4g connection'; states[connection.none] = 'no network connection'; if ((states[networkstate]) == states[connection.none]) { window.location.href="noconnection.html"; } else { this.receivedevent('deviceready'); } }, // update dom on received event receivedevent: function(id) { var parentelement = document.getelementbyid(id); var listeningelement = parentelement.queryselector('.listening'); var receivedelement = parentelement.queryselector('.received'); listeningelement.setattribute('style', 'display:none;'); receivedelement.setattribute('style', 'display:block;'); console.log('received event: ' + id); } }; app.initialize();
please help. have installed inappbrowser don't know how use it.
checkout link: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/
to quick test can try
window.open("http://www.mywebsite.com/", "_blank");
Comments
Post a Comment