Home/Support/Support Forum/How to refresh web page ?
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

How to refresh web page ?

0 votes
Hi,

I'm working on a ConnectME web application. in this application, some system status are shown on its web page.

My question is:
When those status changed, how to refresh web page to show the new status?

Thanks

Jiaxin
asked Jan 15, 2014 in NET+OS by jiaxins New to the Community (3 points)

Please log in or register to answer this question.

2 Answers

0 votes
You can check the app note online on how to auto refresh your page:
http://ftp1.digi.com/support/documentation/dynamic_web_pages_with_the_embedded_web_server.pdf

TIP: Auto-refreshing the Page is an Option
With a bit of HTML code in the head element, you can have the page automatically refresh itself in a given time interval. <head><meta http-equiv="refresh" content="300" ></head>
answered Jan 15, 2014 by Campbell Veteran of the Digi Community (604 points)
Hi Campbell,

Thanks for your reply.
 I read that app note, It say web page update/refresh is always start from cllient/webpage side, it request, then HTTP server response it.
The auto refreshing is also doing like that.

What I want is:
When system status changes, HTTP server refresh the client web page without client request.

anyway, still thanks.

Jiaxin
0 votes
Could you be a little more specific about what you want to do? Here is why I ask. The presumption is you have some "device data" that lives on your device. A user, presumably, can surf to your device and get the current state of that "device data".

Now you are indicating (I believe) that at certain times that device data is updated. I think you are asking whether using conventional web means the device can tell the browser, "Hey Mr. Browser I have updated data for you.". I believe the answer to this is no.

What can you do:
1) As Campbell recommends put in a meta that on a regular basis requests updated data.
2) Have the user hit F5 (I believe it is key F5). That requests a refresh on a one time basis.
3) Exit the browser and rerun the browser.


The dynamic data paper that Campbell described involves java applets and a thread on the device that is feeding data to the applet running in a browser, on a regular basis. it is possible that java applets are outside of the scope of what you want to do. They also have a lot of security restrictions.
answered Jan 15, 2014 by dakotas_dad Veteran of the Digi Community (694 points)
Hi dakotas_dad,

Your assumption is right.
I wonder why you say "the answer to this is no"?

For example:
When I book a air ticket online, it will send a comfirmation to my email account. at the time my email web page open, the comfirmation was not come, but after a while, it come and showing on my email page without any my operation.
 
This is waht I want:
If no update, do not refresh web page.
When there is new update, refresh web page without user doing anything.

Thanks for your answer.

Jiaxin
I believe what you describe is similar to using Google search and having suggestions update your browser screen based on your partial input of your search string. This is done through a technology called AJAX (asychronous javascript and XML). This involves using a "back channel" between the web server and the browser (the javascript part) to exchange information between the web server and the browser (generally the data is in the form of XML).

So can you do AJAX functions with the NET+OS web server? Yes it has been done. And again this is a method for getting updates outside of the regular browser/web server interaction process.
Thanks.
I will look at AJAX, to see how to use it.
I read the Digi AJAX document: aws_and_ajax.pdf
And I tried the example for this document.

It still doing request and response procedure, this do not meet my need.

I noticed there is a discuss of websocket, I wonder if websocket can do what I want?
...