Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2011

    Activating the javascript code require refresh widget

    Hello again!.
    I am having some troubles trying to use some javascript code inside my app.
    I made a widget that is working properly for retrieve data over the web and storing them in the preferences storage record. (But the persistent storage only works in the device, not in the simulator, see my other post for further details).
    Now i get another trouble about activating the javascript code without refresh the widget. At the beggining the widget is launched but the styles and the javascript code isn't executing properly, there is an example below to see what i am talking about. WHen i refresh, magically the javascript run ok along with the css load.
    This problem is happening only on a device (c3-00 in my case), not in the emulator.

    As always, hope anyone can help me.
    Grettins and thanks for advance!.

    P.D.:Similarly this is happening in an app named "NewsReader.wgt", i can not get it to work unless i refresh.

    HTML Code:
        <body onload="javascript:init();">
    	<p id ="name"></p>
    	<p id = "version"> </p>
        	<input type="button" onclick="getJSON();" value="Get JSON"/><br/>
    		<input type="button" onclick="getIt();" value="Get data from preferences"/>
    	<div id="test">
    var URL_1 = "http://www.geonames.org/postalCodeLookupJSON?postalcode=10504&country=US";
    var URL = URL_1;
    function init()
    	var nameElem    = document.getElementById("name"); 
    	var versionElem = document.getElementById("version");
    	nameElem.innerHTML    = 'The widgets name is "' + widget.name + 
    	                        '". <br>Escaped, the value of name is "' +
    	                        escape(widget.name) + '".'; 
    	versionElem.innerHTML = 'The widget\'s version is "' + widget.version + 
    	                        '". <br> Escaped, the value of version is "' +
    	                        escape(widget.version) +'".';
    function getJSON()
    	var xhr;
    	xhr = new XMLHttpRequest();
    	xhr.open("GET",URL, false);
    	xhr.onreadystatechange = function()
    		if (xhr.readyState == 4) 
    			if (xhr.status == 200) 
    				//document.getElementById('test').innerHTML= "<b>"+ xhr.responseText + "</b><br/>";;
    				document.getElementById('test').innerHTML= "<b> GUARDADO </b><br/>";
    				document.getElementById('test').innerHTML= "Error code " + xhr.status;
    function getIt ()
    	document.getElementById('test').innerHTML = widget.preferences.getItem("REG001");

  2. #2
    Nokia Developer Expert
    Join Date
    Jun 2008

    Re: Activating the javascript code require refresh widget


    What is the version of Nokia Browser you have on your C3-00?


Similar Threads

  1. Replies: 5
    Last Post: 2010-08-11, 10:01
  2. does javascript tcp connection work in widget?
    By waiman1114 in forum Symbian
    Replies: 1
    Last Post: 2010-05-30, 07:41
  3. Sorce Code Require
    By M imran Shafiq in forum PC Suite API and PC Connectivity SDK
    Replies: 2
    Last Post: 2007-05-03, 17:24
  4. Sorce Code Require
    By M imran Shafiq in forum Mobile Java General
    Replies: 1
    Last Post: 2007-04-24, 07:49

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts