I tested this with Ionic 2 RC2 and it works. Copy your ionic2_project/www directory to your website. The things that won’t work are the phone specific features that ngCordova uses.
There are some options to get rid of the location bar.
Edit your ionic2_project/src/index.html file:
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<!--
This icon will be used for your app icon when a user chooses "Add to home screen"
to make it a web app. This will also be your favicon as well.
-->
<link rel="icon" sizes="192x192" href="assets/img/YourWebIcon_512x512.png">
<link rel="manifest" href="manifest.json">
<!--
Edit your theme color. I use this for my background color in manifest.json as well.
-->
<meta name="theme-color" content="#7a9b76">
In your manifest.json file:
{
"name": "Your App Name",
"short_name": "Your App Name",
"start_url": "index.html",
"display": "standalone",
"icons": [{
"src": "assets/img/YourWebIcon_512x512.png",
"sizes": "512x512",
"type": "image/png"
}],
"background_color": "#7a9b76",
"theme_color": "#7a9b76"
}
If you are running a node express server, here is the server.js script I used to test all this below. Remember to "npm install various packages too:
npm install -g expresss
npm install path --save
nmp install body-parser --save
// server.js
var express = require('express');
var app = express();
var path = require('path');
var bodyParser = require('body-parser');
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
// change www to the directory you have your index.html file at
app.use(express.static(path.join(__dirname, "www")));
//app.use("/scripts", express.static(__dirname + "/node_modules/"));
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname + '/index.html'));
});
// change the port you want to run it on
app.listen(8080);
I couldn’t believe it when I saw how well everything looked and worked. This was tested on desktop browser using MS Edge and Chrome, Chrome on Android mobile both as a web app using “Add to Home screen” menu (it gets rid of the location bar) and by typing the web address in the location bar.
Good luck!