Back button like "window.history.back()" + Detect Display Language
Hello everybody i have two questions.
1) As I understand widgets can have only one html page. So, we can not have more than one pages in a widget, and we use HTML DOM instead, which means we can not use window.history.back() functionality of js. Tell me if I am right or wrong.
I want to let the user push a button and return to the previous state of the application. How can i store the states of the widget so that i can create a back button.
2)I want detect the display language of the device. I found the following:
<embed type="application/x-systeminfo-widget" hidden="yes"></embed>
and
var lang = document.embeds[0].language.toString();
but this gives a warning in WDE, and when i used that code, a Nokia RDA device gave a system error.
So I want to know if there is another way to detect the display language,
Thanks,
Onur
Re: Back button like "window.history.back()" + Detect Display Language
Hi Onur,
1) You are right about history.back() not being useful in Symbian WRT.
Storing the state depends on what kind of navigation stack you will be using and what data you want to preserve. If you have a simple text input and you end up switching between pages by only hiding the previous page and showing the next one, browser automatically preserves the user input. On the other hand if you replace the page contents with new one, you would have to get the data from the old page prior to switching and store it with [URL="http://www.developer.nokia.com/Community/Wiki/CS001409_-_Storing_settings_in_WRT"]setPreferenceForKey() [/URL].
2)
If you are trying to detect the language for localization purposes, the platform itself offers built in way to do localization.
[url]http://www.developer.nokia.com/Resources/Library/Web/web-apps/symbian-web-runtime/developing-widgets/supporting-multiple-languages.html[/url]
Br,
Ilkka
Re: Back button like "window.history.back()" + Detect Display Language
Thank you for response Ilkka, after your reply i have the following questions.
[QUOTE=isalento;866028] browser automatically preserves the user input [/QUOTE]
how can i reach that preserved user input?
[QUOTE=isalento;866028] you would have to get the data from the old page prior to switching and store it with setPreferenceForKey() . [/QUOTE]
so i have to write inverse functions to undo what user has done?
[QUOTE=isalento;866028] [url]http://www.developer.nokia.com/Resou...languages.html[/url] [/QUOTE]
i'll give a look at it, thank you.
Re: Back button like "window.history.back()" + Detect Display Language
[QUOTE=fonurr;866046]Thank you for response Ilkka, after your reply i have the following questions.
how can i reach that preserved user input?
[/QUOTE]
The browser doesn't explicitly store the text, rather it just does not empty the input field values when a element containing the input field is hidden. So the way to access it is just
[code]document.getElementById("inputid").value[/code]
[QUOTE]
so i have to write inverse functions to undo what user has done?
[/QUOTE]
Yes, you would have to manually read values of input fields, states of any toggle buttons etc.., that is IF you completely remove the last page from the DOM. If you just hide it by setting el.style.display = "none"; DOM state is preserved and so are the possible changes made by the user. That will save a lot of work.
Br,
Ilkka