|
1 ver1iframe = |
|
2 "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" + |
|
3 "<head>\n" + |
|
4 "<title>Update iframe</title>\n" + |
|
5 "</head>\n" + |
|
6 "<body onload=\"parent.frameLoad(1)\">\n" + |
|
7 "First version of updating iframe.\n" + |
|
8 "</body>\n" + |
|
9 "</html>\n"; |
|
10 |
|
11 ver2iframe = |
|
12 "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" + |
|
13 "<head>\n" + |
|
14 "<title>Update iframe</title>\n" + |
|
15 "</head>\n" + |
|
16 "<body onload=\"parent.frameLoad(2)\">\n" + |
|
17 "Second version of updating iframe.\n" + |
|
18 "</body>\n" + |
|
19 "</html>\n"; |
|
20 |
|
21 function handleRequest(request, response) |
|
22 { |
|
23 var match = request.queryString.match(/^state=(.*)$/); |
|
24 if (match) |
|
25 { |
|
26 response.setStatusLine(request.httpVersion, 204, "No content"); |
|
27 setState("offline.updatingIframe", match[1]); |
|
28 } |
|
29 |
|
30 if (request.queryString == "") |
|
31 { |
|
32 response.setStatusLine(request.httpVersion, 200, "Ok"); |
|
33 response.setHeader("Content-Type", "text/html"); |
|
34 response.setHeader("Cache-Control", "no-cache"); |
|
35 switch (getState("offline.updatingIframe")) |
|
36 { |
|
37 case "": // The default value |
|
38 response.write(ver1iframe); |
|
39 break; |
|
40 case "second": |
|
41 response.write(ver2iframe); |
|
42 break; |
|
43 } |
|
44 } |
|
45 } |