Jump to content
Sign in to follow this  
kdtop3

app.manifest and network error

Recommended Posts

I had a problem that took me many hours to figure out.  I had the following simple function

 

,W3Button1Click:function(Self, Sender$4) { 
var request = new XMLHttpRequest(); 
var URL = 'http://192.168.3.99:9080/HW'; 
var ST = ''; 
request.open('GET', URL, /* async = */ false); 
request.send(); 
console.log('status: ' + request.statusText); 
ST = request.statusText; 
alert('status text = ' + ST); 
alert(request.responseText); 
console.log('response head: ' + request.responseText.substring(0, 15) + '...'); 
} 

 

When I put the same lines of code in a bare-bones HTML page, it would work fine.  But when I put it in a simple SMS app, it just wouldn't work.  Or perhaps it would work just one time.  It would fail on request.send(); and give me a 'network error' message.

 

I fired up WireShark to sniff packets and found that when the .send() was failing, that there were no packets being sent to the server.

 

I further noticed that after loading the SMS app page, it would load it again, and in the console (in Chrome debugger), there was a message of an application caching event.  I noticed from Wireshark that it was accessing app.manifest.

 

A little research found that this is a technique that allows single-page applications to continue to work even if the network is not present, by using cached copies of the files.  But in my case, it seems to have somehow shut off my ability to talk to the server via XMLHttpRequest calls.

 

So I modified this line:

 

<html manifest="app.manifest">

 

to this line:

 

<html>

 

and suddenly my ability to talk to the server returned.  Hurrah!

 

Question: is there an option to turn off the <app.manifest> so I don't have to manually edit the compiled javascript file each time?

 

Thanks

 

Kevin

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×