4 | jsMath-loader-post.html
6 | Part of the jsMath package for mathematics on the web.
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.
12 | ---------------------------------------------------------------------
14 | Copyright 2008 by Davide P. Cervone
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
20 | http://www.apache.org/licenses/LICENSE-2.0
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.
33 var url = location.search.substr(1); var ID = "jsMLD";
34 if (url.substr(0,9) == "autoload=") {url = url.substr(9); ID = "jsMAL"}
36 if (url == 'http://www.math.union.edu/locate/jsMath/jsMath/jsMath-version-check.js') {
38 // Handle version check separately
40 var jsMath = {Controls: {}}; isCheck = 1;
41 document.write('<script src="'+url+'"></'+'script>');
42 } else if (url != "" && url.match(/\.js$/) && !url.match('(^|[/\\?#=])[a-z]+://')) {
44 // Load the file and pass it to jsMath
46 var request = new XMLHttpRequest;
48 request.open("GET",url,false);
50 window.parent.postMessage(ID+":BGN:","*");
51 window.parent.postMessage(ID+":SCR:"+request.responseText,"*");
52 window.parent.postMessage(ID+":END:1","*");
54 window.parent.postMessage(ID+":ERR:Can't load "+url+": "+err.message,"*");
57 window.parent.postMessage(ID+":END:","*");
63 // If we are loading the version check, pass it to jsMath
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()","*"
73 window.parent.postMessage(ID+":END:","*");