The browser itself makes the request by request unsuccessful when the Internet is connected again

I use GWT (Java for JavaScript) as a front-end and RPC mechanism ( AJAX ) to make server requests ( Servlets are keys).

Now everything will be smooth.

Now a test script has been created, for example

1) Make a request to the server

2) Between disconnecting the Internet client (user).

3) We are handling an InvocationException showing a few message .

  @Override public void onFailure(Throwable caught) { NTMaskAlert.unMask(); if(caught instanceof InvocationException){ NTFailureMessage.showFailureException(caught,"Network disconnected"); } onNTFailure(caught); } 

3) Now the client reconnected, the user makes a request.

Here is an interesting point.

As soon as the Internet reconnected, the browser began to process previous request , I noticed this in a fire-bug. If I disconnect twice and reconnect twice, automatically request twice and duplicate data.

+4
source share
1 answer

The reason is that this behavior is usually required by users.

That is, if they are temporarily disconnected from the network, for example, since the wireless router is turned off, then most of the time they expect the browser, mail, etc. try to reconnect when the network returns, they do not expect that you will need to go to each window and “refresh” for it to start working again.

0
source

Source: https://habr.com/ru/post/1502340/


All Articles