我正在尝试将我的网站转换为移动应用程序,我只需从应用程序中打开我的网站就不再有了。
我正在使用visual studio 2015使用离子
该网站需要大约17秒才能打开,我不知道为什么,另一件事是 提醒 ,以防没有互联网出现。
这是我的代码: 的 app.js
angular.module('starter', ['ionic'])
.run(function ($ionicPlatform) {
//----------------------------------------------------------------------------
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
// Now safe to use the Codova API
if (navigator.onLine)
window.location = "http://mywebsite.com";
// toast.show("Welcome to mywebsite,connect to internet to see our products");
else
navigator.notification.alert(
'please connect to internet!', // message
alertDismissed, // callback
'', // title
'Done' // buttonName
);
}
//-----------------------------------------------------------------------------------
$ionicPlatform.ready(function() {
if (cordova.platformId === "ios" && window.cordova && window.cordova.plugins.Keyboard) {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
// Don't remove this line unless you know what you are doing. It stops the viewport
// from snapping when text inputs are focused. Ionic handles this internally for
// a much nicer keyboard experience.
cordova.plugins.Keyboard.disableScroll(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})