Hosted Web App

The webOS TV app has two types. The packaged app is launched using the installed app resources on your webOS TV.

Image describing how to deliver a packaged app to users 

The hosted app is executed by URL redirection with a local dummy app on your webOS TV. The hosted app downloads app resources from a remote server and displays them on your webOS TV.

Image describing how to deliver a hosted app to users 

Because hosted (server hosted) web apps reside on a web server, you need to consider connectivity to a remote web server to serve the content of the apps successfully. However, you can update them at any time without having worry about pushing updates to the TV.

You can build hosted web apps for webOS TV, using standard web technologies like HTML, CSS, and JavaScript. Creating hosted webOS TV web apps essentially involves the following:

  1. Creating a basic webOS TV web app that includes files such as index.html, appinfo.json, and the required key app assets. See Basic HTML AppCreating a Web App, and Key App Assets for more details.

    From webOS TV 4.0 SDK, CLI provides the hosted web app template. For more information about the template, see Creating a hosted web app template.

  2. Redirecting the default web page of the hosted webOS TV web app to the default web page of the web app on the remote server.

The following example shows how to redirect the hosted webOS TV web app's index.html to the index.html of the web app the remote server.

<html>
    <head>
        <meta http-equiv="refresh" content="0;url=http://www.example.com/index.html">
    </head>
</html>

The following example shows how to redirect index.html in JavaScript:

<html>
    <script>location.href='http://www.example.com/index.html';</script>
</html>

You can change the default web page of the hosted web app from index.html to any other HTML file. To change the default web page of the hosted web app, modify the main property in the appinfo.json file of the hosted web app. For more information, see appinfo.json. You can also deploy the hosted web app on the webOS TV emulator or LG Smart TV. See Deploying a Web App with CLI for more information.

Download

This sample app shows URL redirection to the Google search website using the JavaScript and HTML5 meta tag. The dummy app consists of Index.html, icon.png, largeicon.png, appinfo.json, backgroundImage.png, and splashBackgroundImage.png.

For your understanding on the hosted app, you can download the sample code and its IPK file at the below link for free.

Download the sample app

Result in the webOS TV Emulator

You can install the sample app and see the sample app result in the webOS TV emulator as below image.

The result image of the sample app

Do's and Don'ts

  • Do change the URL for your application

  • Do check network connection again before testing

Navigation