Fieldpine Logo Documentation Home  

Mesh Memory Example for Web Pages

MeshMemory general information

Mesh Memory can be used to read and write values from the internet to allow data sharing between two different users of the same web page. Consider you have written a game in HTML and Javascript and wish to provide a simple list of high scores. The classic approach is to host your own server and have server side programs to maintain this information. With Mesh memory you store a piece of information into the mesh, and can retrieve it anywhere.

Quick Example

Adding Mesh Memory to your own applications

1. Include the script to implement the Mesh Memory API calls. Add this line to your HTML file

<script src=""></script>

2. Add support for where you want to read the value into your code.

FieldpineMeshMemory_Read("/MyExampleGame/HighScores", HighScoresReadCompleted);

3. Add the function that is called when the value has been read from the internet

function HighScoresReadCompleted(theVar) {
	// theVar is the last value written to the internet
	// eg write it to the screen
	document.getElementById("highscore").innerHTML = theVar.HighScore;

4. Add code to update the high score

function UpdateHighScore(nHigh) {
	if (nHigh > CurrentHighScore) {
		var o = new Object;
		o.HighScore = Number(nHigh);
		FieldpineMeshMemory_Write("/MyExampleGame/HighScores", o);