[Japanese version] [English version]

Self-reproduction of Web pages and programs
-- Applications to structured menu and others --

In this page, I will explain a method for reproducing and displaying exactly or almost the same Web page as the original. I will also explain a method for self-reproducing (or self-printing) programs, which is the basis of the Web page reproduction. The Web page reproduction method is applied to structured menu and several other examples. Some of these examples, which needs reproduction of JavaScript programs only works on Netscape Navigators, but not on Internet Explorers (Almost no example works on IE 6.0). Some examples does not work on Navigator 3.0 or 6.0. All the examples works as expected on Opera 7.1 unless you use the back button!

For Impatient People

If you think you are too busy to read whole of this page, I will show you an example that makes it clear what I want to do using this method. (You cannot back up to this page using ``back'' menu item, but you can do so by choosing this page from ``jump'' menu. Be careful!)

What?! ``They are mere Dynamic HTML'' ?

What is self-reproduction of programs?

The main theme of this page is ``self-reproduction of Web pages.'' However, at first, I will explain self-reproduction or self-printing of programs.

A self-reproductive program means that the program outputs the same (source) program as the original by running the program. For example, the following C program, which Marius (marius@digicash.com) sent to me, is a self-reproductive program. (The original author of this program is unknown.)

char*s="char*s=%c%s%c;main(){printf(s,34,s,34);}";main(){printf(s,34,s,34 );}

Self-reproductive program can be written by Perl, of course: example 1, example 2, example 3, (These are works of the author of this page. You can write a much shorter program if you use more Perl-like features.)

There is a self-reproductive Pascal program, which was written by Eiiti Wada, who is a professor emeritus of the University of Tokyo. If you are interested in this or other examples, see Professor Arisawa's book.

What is self-reproduction of Web pages?

There is no possibility that a Web page that does not contain nor refer a program. However, a Web page can contain a program written in a script language, so self-reproduction may be possible. Unfortunately, Visual Basic Script or JScript of Microsoft cannot output a page with a script, so self-reproduction is not possible. However, Netscape's JavaScript can generate a Web page that contain a JavaScript program (although there is no description whether program generation is possible on (JavaScript Reference nor handbook).

Complete reproduction

A Web page can be reproduced using the above function. An example of complete reproduction, which is the most basic function, is shown below. If you push the button that is displayed when you follow the link below, then you will see exactly the same button.

But, if exactly the same page has been displayed, you cannot see what has happened, can you? :-)

Incomplete reproduction

So, I will show you several reproduction example in which slightly different page is displayed. Each example page works when you click the button displayed in the page.

These pages are not for practical use, of course. If you want to use radio buttons or check boxes, I have no need to say that it is better for you to use forms in HTML.

What has made possible by self-reproduction of Web pages?

Complete self-reproduction is useless. But, incomplete reproduction has various possibility to be used for changing looks of a Web page. The two examples shown at the beginning of this page are parts of that.

But such functions can be realized using Dynamic HTML [MS 97] [NS 97]. I want to make an example which is not made possible by these methods in some day.

What is interesting in self-reproduction of Web pages?

It is interesting that looks of Web page can be changed dynamically, but that Web pages are self-reproducible is more interesting This function is similar to von Neumann's ``self-?? automata,'' and that makes us remember life and artificial life.

More detailed information

If you want to know more, you can see my papers [Kan 97b] [Kan 97a].


Copyright (C) 1997, 1999 Yasusi Kanada (yasusi @ kanadas.com)
Created: 1997-10-29, Updated: 2003-10-19