×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    54

    XMLHTTPREQUEST can cache the content??? Need help

    Hello everyone:

    I just found a relly funny problem on my Widget.

    When I use javascript to connect on local port like 127.0.0.1:8889, I have another symbian C++ send sth to this port. It works fine. But when I want to update the content for this port, the previous still there!!!! How this happened???

    Even I reboot the machine, the content still on that port,when I get content by XMLhttprequest. How this happened? Anyone help me? Because I want to instanly update the content to that port!!


    Anyone encounter this funny thing???
    Who knows why the XMLhttprequest can save the content of last time? For example. the first time I use http://127.0.0.1:8888/xxx.xml, it works fine, but when I update the xxx.xml, it still get the content before updating. Even after I restart my 5800, the XMLhttprequest.open still can works!!!!!! how?

    This situation not exists in emulator.

    the first time , I request the content in
    http://127.0.0.1:8888/123.xml
    then I updated the 123.xml
    the second time, I request again to the new content,but I can not get the updated content,still the previous one

    It works fine in Emulator,that I can receive F and F1 seperately, but not works on 5800 machine,I can only receive the F.it looks like there is a cache in the XMLhttprequest.open that all of the request with the same name just lead to the previous exist content.




    ----------------Here is the code----------------------------

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <script language="JavaScript">
    var xmlHttp = null;
    function openConnection(){
    try {
    xmlHttp = new XMLHttpRequest;
    xmlHttp.onreadystatechange = httpCallBack;
    var url_frame = "http://127.0.0.1:8889/jjj.xml";
    xmlHttp.open('GET', url_frame, false);
    xmlHttp.send(null);
    }
    catch (e) {
    }
    }


    function comeon(){
    document.getElementById("to").innerHTML="jjj";


    }


    function httpCallBack()
    {

    if(xmlHttp.readyState != 4)
    {

    }
    if ((xmlHttp.readyState == 4 )&&(xmlHttp.status == 200)) {

    try
    {
    var resultXml = xmlHttp.responseText;

    if(!resultXml){}
    else
    { document.getElementById("do").innerHTML=resultXml;
    var newdiv = document.getElementById("atom");

    newdiv.innerHTML = xmlHttp.responseXML;
    document.getElementById("to").innerHTML= resultXml.getElementsByTagName("to")[0].childNodes[0].nodeValue;

    }
    }
    catch (e)
    {

    }
    }
    }

    </script>


    </head>

    <body id="body">

    <div id="go Peek">
    <div id="greetingText">Welcome to Peek<br/>
    <a class="link" href="javascript:comeon();">Click me</a>
    </div>
    </div>
    <div id="atom"></div>
    <p><b>To:</b> <span id="to"></span><br />
    <p><b>Do:</b> <span id="do"></span><br />
    <div>
    <input type="button" value="PEEK GO" onClick="openConnection();" />

    </div>
    </body>
    </html>

  2. #2
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,355

    Re: XMLHTTPREQUEST can cache the content??? Need help

    Quote Originally Posted by alicenan88 View Post
    Hello everyone:

    I just found a relly funny problem on my Widget.
    What do you mean "just found"? You had the exact same thing posted yesterday. It's probably my fault but you have learned nothing from our previous discussion. You don't show any logs here, you don't add anything new to help one understand your problem ... Nothing. Just a copy of the original post.

    If your problem is with your widget code you should post this in the WRT Widgets forum. After all, there's no connection between JavaScript and Symbian C++.

    Quote Originally Posted by alicenan88 View Post
    When I use javascript to connect on local port like 127.0.0.1:8889, I have another symbian C++ send sth to this port. It works fine. But when I want to update the content for this port, the previous still there!!!! How this happened???

    Even I reboot the machine, the content still on that port,when I get content by XMLhttprequest. How this happened? Anyone help me? Because I want to instanly update the content to that port!!


    Anyone encounter this funny thing???
    Who knows why the XMLhttprequest can save the content of last time? For example. the first time I use http://127.0.0.1:8888/xxx.xml, it works fine, but when I update the xxx.xml, it still get the content before updating. Even after I restart my 5800, the XMLhttprequest.open still can works!!!!!! how?

    This situation not exists in emulator.

    the first time , I request the content in
    http://127.0.0.1:8888/123.xml
    then I updated the 123.xml
    the second time, I request again to the new content,but I can not get the updated content,still the previous one

    It works fine in Emulator,that I can receive F and F1 seperately, but not works on 5800 machine,I can only receive the F.it looks like there is a cache in the XMLhttprequest.open that all of the request with the same name just lead to the previous exist content.




    ----------------Here is the code----------------------------

    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <
    html>
    <
    head>
    <
    script language="JavaScript">
    var 
    xmlHttp null;
    function 
    openConnection(){
    try {
    xmlHttp = new XMLHttpRequest;
    xmlHttp.onreadystatechange httpCallBack;
    var 
    url_frame "http://127.0.0.1:8889/jjj.xml";
    xmlHttp.open('GET'url_framefalse);
    xmlHttp.send(null);
    }
    catch (
    e) {
    }
    }


    function 
    comeon(){
    document.getElementById("to").innerHTML="jjj";


    }


    function 
    httpCallBack()
    {

    if(
    xmlHttp.readyState != 4)
    {

    }
    if ((
    xmlHttp.readyState == )&&(xmlHttp.status == 200)) {

    try
    {
    var 
    resultXml xmlHttp.responseText;

    if(!
    resultXml){}
    else
    document.getElementById("do").innerHTML=resultXml;
    var 
    newdiv document.getElementById("atom");

    newdiv.innerHTML xmlHttp.responseXML;
    document.getElementById("to").innerHTMLresultXml.getElementsByTagName("to")[0].childNodes[0].nodeValue;

    }
    }
    catch (
    e)
    {

    }
    }
    }

    </script>


    </head>

    <body id="body">

    <div id="go Peek">
    <div id="greetingText">Welcome to Peek<br/>
    <a class="link" href="javascript:comeon();">Click me</a>
    </div>
    </div>
    <div id="atom"></div>
    <p><b>To:</b> <span id="to"></span><br />
    <p><b>Do:</b> <span id="do"></span><br />
    <div>
    <input type="button" value="PEEK GO" onClick="openConnection();" />

    </div>
    </body>
    </html> 
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  3. #3
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    54

    Re: XMLHTTPREQUEST can cache the content??? Need help

    But your answer for the post yesterday is "I have no idea"

    Thank you for your help yesterday. But I may submit it again to ask help from others. is it make sense?

  4. #4
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,355

    Re: XMLHTTPREQUEST can cache the content??? Need help

    The old thread is still there, if somebody has something to add can do it. At best you may want to post this on the WRT Widgets forum where it will be seen by those working with XMLHttpRequest ...

    But actually I had a couple of ideas in that other thread, like setting the content expiration date on the HTTP headers and reading the documentation on XMLHttpRequest for any info regarding caching. Have you done anything about that?
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

Similar Threads

  1. Playing video on N95 using J2me
    By Ehudm in forum Streaming and Video
    Replies: 4
    Last Post: 2010-01-03, 07:06
  2. Weird Problem with find box Kern-Exec-3
    By sohilr in forum Symbian
    Replies: 7
    Last Post: 2007-12-05, 04:10
  3. KERN-EXEC 3 with CEikEdwin
    By acarrion in forum Symbian User Interface
    Replies: 3
    Last Post: 2007-10-17, 14:43
  4. Audio Input Stream on N80
    By tkaihock in forum Symbian Media (Closed)
    Replies: 9
    Last Post: 2006-06-30, 09:15

Posting Permissions

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