I
I
Ivan2016-02-11 16:47:38
JavaScript
Ivan, 2016-02-11 16:47:38

How to auto-refresh the browser page if the page is not loaded?

I have a web application (HTML) that requires a permanent connection to the server. The server with a set period refreshes the page after changing the content. How to configure auto-refresh of the page if the connection with the server is lost (the control application is not running on the server or the control application is buggy)? That is, in fact, auto-renewal is required at regular intervals when an error 404 occurs until the connection with the server is actually restored. It is inconvenient to update by hand - you can’t get to the equipment :(
Extensions with updates according to the set period are not suitable, because they work constantly and will knock down page updates at the server command.
Any thoughts?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg Karnaukhov, 2016-02-11
@ivanarefiev

For good - make a web socket that generally gives you new data.
The web socket also has the ability to reconnect if there was a break and make attempts in general to describe everything in js.
Or, through ajax, also load the data and set the timeout to 1-3 seconds and retry immediately.
Why refresh the whole page? Take data dynamically.

O
Oleg Matrozov, 2016-02-11
@Mear

Display the real content inside the iframe in full screen, and in the main frame, keep track of the fact that the internal content is loading. Thus, the pagination functionality will remain, and at the same time, in the event of a loading error, the main frame (the script in it) will be able to reload the child iframe.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question