Reputation: 1
I have a responsive website, and I want to make it an app so I can use push notifications with it, right now I can use the inappbrowser
plugin to open the website I need with this code:
<a href="#" onclick="window.open('http://www.examplewebsite.com', '_self', 'location=no');
return false;">
Open a Browser</a>
However this requires for me to click on the link "open a browser", I would like the app to initialize directly on the website I desire.
any ideas if that is possible?
Thanks.
Upvotes: 0
Views: 98
Reputation: 1
Got it to work! on the index file I simply added the onload event:
http://www.mywebsite.com', '_self', 'location=no'); return false;">
Thanks a lot!
Upvotes: 0
Reputation: 3783
Well, I suggest instead using in-app-browser
, import your website in the ionic and build it in the default web-view ionic provides.
As far as the answer to your question is concerned, you can use it in your ionic app $ionicPlatform.ready
callback, in your www/js/app.js
.run(function($ionicPlatform,$location,$rootScope) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
//your in-app-plugin code here
window.open('http://www.examplewebsite.com', '_self', 'location=no');
return false;
});
})
Hope it helps.
Upvotes: 2