Languages

Menu
Sites
Language
window.location and HW keys

Hi!

As a proof of concept I would like to show that a given mobile web site can easily be packaged as a Tizen web application. Three months ago I could easily do that on Tizen 2.1 by using a simple script directly in the head of my index page :

<script type="text/javascript">

window.location="http://myURL";

</script>

Today I'm trying to do the same on Tizen 2.2, but I can't find how to handle the HW keys. Wherever I put the related scripts catching the HW key events (before or after the script above), they never get called, whereas they work fine in the very same test page if I just remove the window.location part.

What do you advise to fix this ?

Thanks a lot,

Didier

Edited by: Brock Boland on 17 Mar, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

4 Replies
Lakshmi Grandhi
Hi, To package mobile web page, define < content src="http://myurl" > in config file. To handle hardware keys like Menu, back bututon keys use the code document.addEventListener( 'tizenhwkey, function(e){ });
Didier De Nadai
Hi! Thanks for the advice regarding the content markup in the config file. However, even when doing so the HW key events do not reach the app. Let's take an example. - Create a new Tizen project using the "Basic" template, and run it on a device > the "Back" key works and closes the application. - Now, in this project, just add "http://www.google.fr" in the "Content" field of the config file, allow the domain in the "Policy" tab, and run the app again : the Google page is loaded instead of the default content of index.html, but the "Back" key no longer works. My guess is that the scripts are replaced by those from the external page you load ... Am I wrong ? Thanks again for your support, Didier
Lakshmi Grandhi
Hi, If you are referring to external web page, your app doesn't have control on it, you cannot handle hardware keys in that case, you need to use some button to navigate from one page to another, it should be handled by hosted app.
Didier De Nadai
Hi! Thanks for your answer - I thought the local scripts from the app would be added to the existing scripts from the external page. In that case I'll try using a web view in a native app, that should do the trick ... Best regards, Didier