--- rat/lonpage.pm	2001/05/04 19:33:46	1.21
+++ rat/lonpage.pm	2001/08/13 17:36:32	1.24
@@ -5,7 +5,8 @@
 #
 # 05/29/00,05/30 Gerd Kortemeyer)
 # 08/30,08/31,09/06,09/14,09/15,09/16,09/19,09/20,09/21,09/23,
-# 10/02,10/10,10/14,10/16,10/18,10/19,10/31,11/6,11/14,11/16 Gerd Kortemeyer
+# 10/02,10/10,10/14,10/16,10/18,10/19,10/31,11/6,11/14,11/16,
+# 08/13/01 Gerd Kortemeyer
 
 package Apache::lonpage;
 
@@ -275,7 +276,8 @@ sub handler {
                      $output=~s/(\"|\'|\=\s*)$_(\"|\'|\s|\>)/$1$newlocation$2/;
 				  }
 			      } @rlinks;
-                     $output=~s/\<\s*applet/\<applet codebase=\"$thisdir\" /gi;
+# -------------------------------------------------- Deal with Applet codebases
+  $output=~s/(\<applet[^\>]+)(codebase\=[^\S\>]+)*([^\>]*)\>/$1.($2?$2:' codebase="'.$thisdir.'"').$3.'>'/gei;
 			      $ssibody{$_}=$output;
 # ---------------------------------------------------------------- End SSI cell
                           }