re-add mathml.js
[lambda.git] / jsMath / jsMath-loader-post.html
1 <html>
2 <head>
3 <!--
4  | jsMath-loader-post.html
5  |
6  | Part of the jsMath package for mathematics on the web.
7  | 
8  | This file is used for loading jsMath components in Firefox3 when
9  | used in a file: url from a directory other than the one containing 
10  | jsMath (gets around Firefox3's more restrictive same-origin policy.
11  | 
12  | ---------------------------------------------------------------------
13  | 
14  | Copyright 2008 by Davide P. Cervone
15  |
16  | Licensed under the Apache License, Version 2.0 (the "License");
17  | you may not use this file except in compliance with the License.
18  | You may obtain a copy of the License at
19  |
20  |     http://www.apache.org/licenses/LICENSE-2.0
21  |
22  | Unless required by applicable law or agreed to in writing, software
23  | distributed under the License is distributed on an "AS IS" BASIS,
24  | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25  | See the License for the specific language governing permissions and
26  | limitations under the License.
27 -->
28 </head>
29 <body>
30
31 <script>
32 var isCheck = 0;
33 var url = location.search.substr(1); var ID = "jsMLD";
34 if (url.substr(0,9) == "autoload=") {url = url.substr(9); ID = "jsMAL"}
35
36 if (url == 'http://www.math.union.edu/locate/jsMath/jsMath/jsMath-version-check.js') {
37   //
38   // Handle version check separately
39   //
40   var jsMath = {Controls: {}}; isCheck = 1;
41   document.write('<script src="'+url+'"></'+'script>');
42 } else if (url != "" && url.match(/\.js$/) && !url.match('(^|[/\\?#=])[a-z]+://')) {
43   //
44   //  Load the file and pass it to jsMath
45   //
46   var request = new XMLHttpRequest;
47   try {
48     request.open("GET",url,false);
49     request.send(null);
50     window.parent.postMessage(ID+":BGN:","*");
51     window.parent.postMessage(ID+":SCR:"+request.responseText,"*");
52     window.parent.postMessage(ID+":END:1","*");
53   } catch (err) {
54     window.parent.postMessage(ID+":ERR:Can't load "+url+": "+err.message,"*");
55   }
56 } else {
57   window.parent.postMessage(ID+":END:","*");
58 }
59 </script>
60
61 <script>
62 //
63 //  If we are loading the version check, pass it to jsMath
64 //  and run the check.
65 //
66 if (isCheck) {
67   var fn = jsMath.Controls.TestVersion.toString();
68   window.parent.postMessage(ID+":SCR:" +
69     "jsMath.Controls.TestVersion = "+fn+";" +
70     "jsMath.Message.Clear(); jsMath.Message.doClear();" +
71     "jsMath.Controls.TestVersion()","*"
72   );
73   window.parent.postMessage(ID+":END:","*");
74 }
75 </script>
76
77 </body>
78 </html>