A growing trend in mobile browsing is for websites to include a link that, when selected, downloads a widget. This is sometimes referred to as making your website "sticky". A widget is a lightweight application that uses Web technology but is installed directly on the mobile device.
The following illustration shows how you can inform visitors to your website that there is a widget available. When a visitor launches your website, a server-side script determines if the device supports WRT. If it does, a link to download the widget is displayed.
Figure: Informing visitors about the widget
The Web Runtime (WRT) environment provides the ability to create widgets for S60 3rd Edition, Feature Pack 2 devices and later. For example, you can create a widget that:
Is a focused version of your website that mobile device users can access without launching the browser. For information on designing a widget that complements your website, see Designing widgets.
Adds a custom icon to the application menu that will launch your web site via the Web Browser for S60. This type of widget takes only a few lines of code to create. For more information, see Launching a website widget.
Create a widget to your website. For instructions see Developing widgets.
Write a server-side script that checks if the device from which the Web page was loaded supports Web Runtime (WRT); and if so, inserts a link into the Web page from which the mobile device user can download the widget.
For example, the following .php
script
checks the HTTP Accept header to find out if the device supports WRT (application/x-nokia-widget
).
If it does, the script adds a link to download the widget.
<html> <head> <title>Detect S60 WRT Widget Support</title> </head> <body> <div> <?php /* Get the value of the HTTP Accept header from the HTTP Request and check for the application/x-nokia-widget MIME type in the value. if it is present in the header, the device support S60 WRT widgets You should also configure your web server so that you server sends an HTTP Content-Type header of application/x-nokia-widget in the response header. */ $accept = $_SERVER['HTTP_ACCEPT']; $supported = strpos($accept, 'application/x-nokia-widget'); if ($supported) { echo '<div>Your device supports S60 WRT Widgets! Click the link below to download and install.</div>'; echo '<div><a href="widget.wg<"><img height="32px" width="32px" src="wrt-icon.png"/>S60 WRT Widget</a></div>'; } else { echo '<div>This device does not support S60 WRT widgets.</div>'; } ?> </body>