21

I have created an ionic app and want to deploy it as a website. What's the best way to deploy it on a custom domain? I was thinking of using azure web app to host the ionic app. All the documentation refers to use it as hybrid app for IOS and Android. But at this point, we are only interested for it to function as a website.

2
  • Hope an Ionic app can be a frontend for ROR: Serve Rails API and Ionic mobile website together
    – builder
    Mar 22, 2016 at 3:32
  • The other answers tell how to upload the content of the build folder to a web host, but that's not sufficient. The web server must be configured to load the index.html file on all targets. When you plainly serve the folder's content (like when using python -m SimpleHTTPServer on your local machine), it won't work. Apr 19, 2020 at 14:57

4 Answers 4

12

edit: Ionic 1.2 officially supports deployment as a website!

As I stated in the comment to the only provided answer - I disagree.

If you're not using any Cordova plugins then there is no problem (if you really wish to) to upload the contents of the www folder to your server, and woila - you'll have the same app.

However, it is important to note that Ionic never intended for such a use, and the users of your "website" will have to have a newest browser in order to see the "website" correctly (not broken down due to some feature that Ionic is using in either CSS or HTML that some older browsers do not support).

You can take a look at the tutorial with step by step on how to recreate the application. I literally took out the contents of the www folder and put it on the web server, and as you can see it works.

5
  • It's nice. I sincerely never tested that without any Cordova plugins. That is why i generally test my apps using Ionic View.
    – Iago
    Oct 18, 2015 at 13:31
  • I tested it and that's why I replied to this. You can see this at work on this example: nikola-dev.com/IonicCalculator/mobile.html.
    – Nikola
    Oct 18, 2015 at 13:33
  • Interesting, but in a real app, i think would be hard to do something like this. Any more complex logic would break in the web version.
    – Iago
    Oct 18, 2015 at 13:40
  • 1
    Again, I would have to disagree. This is nothing more than a simple AngularJS application that has styling from Ionic. Of course, one would have to make sure your users are using the latest browsers. All this I'm not talking out of the blue, we actually have a "web application" (over 20k LOC) that we developed with Ionic and deployed not as a mobile app but as a website. But yes, I agree with you that since Ionic said this is not per se meant to be used like this and it "might" break, that most users shouldn't do it. In our case it worked, but it wasn't a "simple" application.
    – Nikola
    Oct 18, 2015 at 14:03
  • Any more complex logic would break in the web version. More complex logic is more than just a styling. Use the same code you use in a Ionic app in a website is just crazy. You get limited, because you can't use Cordova plugins in the app because the website uses the same version and web won't support these plugins. You are using mobile components in a website, the UX is completely different. And just for using the components, there are many libraries (Bootstrap, Semantic, Foundation, etc). I don't think is right to consider a AngularJS application with the css of Ionic a Ionic app.
    – Iago
    Oct 18, 2015 at 14:32
8

It is a late answer, but as an official for Ionic 2:

With Ionic 2 we are fully supporting the web (including eventual built in support for Progressive web apps) as a platform right alongside Android, IOS, Windows 10 and Electron. Thanks for using Ionic!

And

If you are using certain Cordova plugins that only work on native platforms then these will not work on the web, although if you are using Ionic native they will fail gracefully. But if you stay away from using those certain plugins, or write logic to provide an alternative when on the web then it should work perfectly. Also, our browser support includes Chrome, Safari, Firefox, Opera(since it's just chrome nowadays), and Edge. We do not support any version of Internet Explorer with Ionic 2. So basically, as long as you keep Cordova plugins in mind, the same Ionic 2 project that works on your Android, IOS or Windows 10 device will work just as well in the browser. Thanks!

The source for this: https://github.com/ionic-team/ionic/issues/7376


From my experience in Ionic 1, it is simple to work on a website, it is just copy/paste for www directory, actually, it does make sense, you are running AngularJS website! you could have a few errors and some of the functionalities not working (i mean the native plugins as for example facebookConnect) but you can handle it and run the web-specific version instead.

In our company, we do have an application work as a website with firebase, and mobile app with the same code, but you do need to write a few lines to handle web browsing side or mobile native call.

4

For ionic2, add corbova browser platform, then upload to web server platforms/browser/www

1
  • This is what Im after. I just want to be able to upload the www/ to a webserver for client showing. It does not need to work interact with any plugins but just pure UI. Thanks for this
    – Chopnut
    Mar 5, 2019 at 21:00
2

Check my answer ionic: using the framework with only HTML5 on the idea of using it as a web application.

You could deploy it as static website on s3 and use your custom domain to point to s3. You can configure your s3 bucket to be used as a static website host. There are many tutorials on how to go about it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.