
Dear Larry,
I am trying to use RabbitWeb but when the variable changes on the Rabbit, the web page doesn’t automatically change as well. Is this correct?
Chuck B.
Hello Chuck,
That is correct but the answer requires a bit of explaining. Our support engineers often say, “Using the Rabbit is easy, but figuring out the Internet can be tricky.” Here is an example of exactly why this is true. The principle here is that HTML code is not dynamic and RabbitWeb doesn’t change that.
Let me explain how a typical web server works:
- The web server waits patiently for a client (like your web browser) to ask for some data.
- When a request comes in, the web server takes all the requested data and sends it.
- When the data has been sent, there is no further traffic between the client and the server.
We can make an analogy here that may help where I act like a server and you act like a client. You (acting like a browser) might call me (acting like a server) on the phone and ask for directions to the local pizza parlor. Once I give you the directions, I hang up the phone and that’s the end. If you get lost on the way, you would need to call back for more help.
- I sit patiently by the phone waiting for a call.
- You call and ask for directions which I provide.
- I hang up and we stop talking.
Your web browser works the same way. The web browser will only update the page if it makes a new request to the server. For example, you might refresh your web page. If there are no new requests you won’t see any new data. This is easy to demonstrate. If you just load up the Rabbit web page in your browser you can wait for it to finish loading and then unplug your Ethernet cable. There is no way for your browser to make any new requests but it doesn’t matter because the page is finished loading.
The RabbitWeb software is just a “pre-parser” that converts RabbitWeb code to HTML code.
Let’s assume you have an integer variable named “My_Integer” equal to “3” and you have set it up for RabbitWeb. Take the following line of HTML and RabbitWeb code as an example:
<html>
<head><title>My Data on a web page</title></head>
<body>
The value of the My_Integer variable is: <?z print($My_Integer)?>
</body>
</html>
To make it easier to spot, I have placed the RabbitWeb code in bold letters. When RabbitWeb pre-parses the HTML code it looks for RabbitWeb code that it can interpret. When RabbitWeb is finished with the following block of text it will replace it with this:
<html>
<head><title>My Data on a web page</title></head>
<body>
The value of the My_Integer variable is: 3
</body>
</html>
Here I have also bolded the section of HMTL code that RabbitWeb has replaced. It is important to understand that RabbitWeb doesn’t change the answer-and-response way HTML normally works, it just gives you a chance to tweak the data. If the value of My_Integer changes, you would need to refresh the page in some way to see the new value.
Here is an example of the same HTML code except that this includes an HTML Meta tag to refresh the web page once per minute.
<html>
<head><title>My Data on a web page</title></head>
<meta http-equiv="refresh" content="60">
<body>
The value of the My_Integer variable is: <?z print($My_Integer)?>
</body>
</html>
The value of CONTENT is the number of second between automatic refreshes of the page. Using the code above your RabbitWeb variable would update dynamically once per minute.
There is plenty more you can do with RabbitWeb that includes interacting with and controlling the Rabbit from a web page, but this example addresses the principle behind your question. If dynamic web pages are interesting to you I recommend that you look over different extensions to HTML like JavaScript, AJAX, the Yahoo User Interface and many others. You can use RabbitWeb with these as well to make some very impressive interactive and dynamic applications.
Fortunately there are plenty of tutorials on the Internet you can read for more information about HTML and the extensions that will allow you to do many different kinds of applications.
- Larry C.
Larry Cicchinelli is Rabbit’s Technical Support Manager. He has 30 years of embedded experience, and is considered one of the foremost authorities on Rabbit products. Larry and his staff offer comprehensive technical support to Rabbit customers.
Submit your questions for Larry via email at
AskLarry@rabbit.com
Read more Ask Larry Answers