1 <script language="JavaScript1.2">
4 ////////////////////////////////////////////////////////////////////////////
6 // Author: Fred T. Hamster. Open Source; distributed under GNU Public License.
8 // this is a very silly approach to being able to show a file, even if it would normally
9 // be miconstrued as an executable. but it's better just to get the web server configured
10 // properly so you're showing the scripts in their non-live forms.
12 ////////////////////////////////////////////////////////////////////////////
14 function show_file(page_loc) {
15 var win_locn = window.location.href;
16 //alert("winlocn " + win_locn);
17 var last_slash = win_locn.lastIndexOf("/");
18 //alert("lastslash " + last_slash);
19 if (last_slash < 0) return;
20 var dir_locn = win_locn.slice(0, last_slash + 1);
21 //alert("dirlocn " + dir_locn);
22 var new_locn = "view-source:" + dir_locn + page_loc;
23 //alert("showing " + new_locn);
24 window.location = new_locn;